SQL Syntax Embedded in Method Call Scripts

Previous Next

To embed SQL method call scripts, use the SqlScript() and FORMULA() methods, or call a decision using ActionDecision().

SqlScript()

To perform database queries or data manipulation in non-SQL contexts, call the USoft-native SqlScript() method and provide the SELECT, INSERT, UPDATE or DELETE statements as a parameter.

To delete all child records corresponding to an on-screen primary key value, write:

SqlScript

(

 DELETE FROM RESERVATION

 WHERE schedtour_id =

   :"query.schedtour_id()"

)

 

FORMULA()

To call SQL functions such as ROUND() or the concatenation function in non-SQL contexts, use the USoft native FORMULA() method.

To write a date 3 days later than the current on-screen book date in a text box, write:

Variables.Text_Box_1( FORMULA( ':1 + :2', query.bookdate(), '3' ) )

ActionDecision()

To perform database queries and use the retrieved values for further processing, call ActionDecision() in your method call script. An example of data retrieval in the Decision SQL is:

SELECT  discount

FROM    person

WHERE   person_id = :"query.made_by"

 

The Decision Yes Action could read:

query.reservation_discount(:1)

where the :1 placeholder represents the value(s) retrieved by the Decision SQL query.