Set Named Data Source (Global Data Field) Value from VBScript Follow

0
Avatar
John Cummens

BT 2016 R7 - Enterprise Automation Edition

I am attempting to update a global data field (in BT system database) with a value, but nothing I have tried so far has been working.

What I am trying to do is to create a single data entry form that will determine the data that would be used by two templates.  Data should be entered into the form on the first template, the values that were entered should be committed to the system database/update the value of those variables in the system database, and the values from the system DB should be used by the second template.  The templates will then be put into a batch, and the entire thing run through print-station.  User will run the batch, enter the data for the product a single time, and the two different templates (different size labels, on different printers), will print in unison.

 

Currently I am trying to run a simple script from within the OnProcessData event from a query prompt (query prompt needed to pull proper record from the product db).

 

The following does not update the value at all:

Format.NamedSubStrings("STOCK-SKU").Value = "FOO"
MsgBox("Current global value is: "+Format.NamedSubStrings("STOCK-SKU").Value) //returns the original/default value


The following returns a syntax error (This function or setting of property is not supported by Visual Basic Scripting)
Call Format.SetNamedSubStringValue("STOCK-SKU", "FOO")

 

What is the proper method to -set- the value of a named data source, and specifically to update a global data field in the system DB?

 

Any insight would be appreciated;

2 comments

0
Avatar
Pete Thane
Comment actions Permalink

Hi John,

Maybe I am not understanding what you are actually trying to do, but do you need the VB at all?

If I add a Global Data Field on to both Labels A and B and make the field on A a prompted field (on the Data Entry Form)  and then add these 2 formats into a new batch file, when I run the batch I am asked to enter the value for the prompted (Global) field and this appears on both printed labels automatically.

Pete

0
Avatar
John Cummens
Comment actions Permalink

Hi Pete;

Thanks for the reply.  What you propose would work (and does work), however I may have forgotten a bit of pertinent information in my original post.

Label A uses a query prompt to determine the record to print.  It is this value returned from the query prompt that I want to push into the global data field, as that same value is needed in Label B.  Hence the desire to use VB to update the global field with the value entered into the query prompt (as I'm unable to find any other method to link a query prompt to a global field).

Thanks;

Please sign in to leave a comment.