AnsweredAssumed Answered

Using Variables as ExecuteSQL Parameters

Question asked by CP42Kx07 on Aug 25, 2014
Latest reply on Aug 26, 2014 by CP42Kx07

I am just starting to play around with the ExecuteSQL script step.

 

How does one incorporate a variable (local or global) as a parameter?

 

I am able to make the search work using a field:

 

ExecuteSQL(

"SELECT "Tx ID"

FROM "Tx__Txns"

WHERE "Tx Category" = 'Asset' AND "Tx Date" <= ? AND "Tx Hg As Pf Qty" > 0";

"";

¶;

TX__Txns::Tx g_Filter Date)

 

but am unable to do so using Let() and a local variable (type: date) from the calling script:

 

Let (

FilterDateFinal = $FilterDateFinal ;

ExecuteSQL(

"SELECT "Tx ID"

FROM "Tx__Txns"

WHERE "Tx Category" = 'Asset' AND "Tx Date" <= ? AND "Tx Hg As Pf Qty" <> 0";

"";

¶;

FilterDateFinal ) )

 

I have tried single quote marks around the variable (FilterDateFinal = '$FilterDateFinal') to no avail.

 

Alternatively, is there a way to use the variable directly in the WHERE request ("Tx Date" <= $FilterDateFinal) or similar?

 

Any ideas would be much appreciated. Thanks

 

 

CP

Outcomes