Setting Global Variables in Script
[Minimum WOW 7.02] The following code can be inserted into an operations title or instructions or an HTML Code operation:
??>GlobalAttr|setGlobalAttribute|accountNumber|123
This will set a global variable with name “accountNumber” to the value of 123. You can erase or null out a global using:
??>GlobalAttr|setGlobalAttribute|accountNumber|null
Similar methods can be used to get the value of a global.
??>GlobalAttr|getGlobalAttribute|accountNumber
For further details on Global Variables see this workflow section:
NOTE: WOW also includes some special variables that will include the entire operation generation. For example:
??<WOWOP-1104*
This will execute operation with ID = 1104 and include the results in place of the variable. The operation being included must also exist inside the current application. (IE... the operation including another operation must both be in the same application)
NOTE: Including an operations results has limitations. It does not include editable results, sorting, paging and other advanced features. It is recommended for including HTML, Java Script, or the read only results of an operation.
Tags: Run operation and include full html in place.
Defaulting Parameter Values
Normally when user needs to fill in a parameter’s value, that parameter will default to a blank value.
For example, if your query is:
SELECT * FROM PJDATA.CUSTOMER WHERE BALANCE > ?
The prompt shown to the user would look something like this:
However, if you want your parameter to have a default value of 1000, you can specify this is your SQL statement.
Using the code:
SELECT * FROM PJDATA.CUSTOMER WHERE BALANCE > ?{1000}
...tells WOW that it should use a default value of 1000 for the parameter. Running an operation with the above code
results in this prompt (before the user enters any data in):
The user can type in any value he or she wants; 1000 is just a default value. If your field has possible values and you want
to use a default value, remember that you need to use the value you want as the default, not the display value.
In general, any parameter that is displayed to the user can be given a default value by appending the default value, enclosed
in curly braces, onto the end of the parameter (there should not be any spaces between the rest of the parameter and the
opening curly brace). Here are several more examples of SQL statements which assign default values to parameters:
CALL PLANETJ.MY_SPROC (?45, ?92{Red}, ?14{Orange})
DELETE FROM PLANETJ.EMPLOYEE WHERE LASTNAME = ?{Stewart} AND FIRSTNME = ?
SELECT * FROM ?~PLANETJ.MYTABLE{PLANETJ.THISTABLE}
SELECT * FROM PLANETJ.EMPLOYEE WHERE HIREDATE BETWEEN ?{*current - 365 days} and ?{*current}
NOTE: '*current' is a special value used by WOW to specify the current date.
Manipulation can be done using 'days' as in the example above.
If the default value is a character string and contains spaces, you may need to delimit the value with double quotes (“”).
For example, if the default is ‘General Accounting’, then specify as: ?{“General Accounting”}.
TAGS: Default search value, search value default, default search string