Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Varaiable in SQL WHERE instruction

Hello Everybody,

i'd like to know if it's possible to pass a variable from an inputbox in a WHERE from SQL connection.

Ex:



Load

Input('Valeur dentrée', 'Zone de saisie') as v,

Recno() as r



autogenerate 1;

ODBC CONNECT TO ADX_ADXV140 (XUserI ........................);

LOAD

"XYEAR_0" as "ANNEE",

"XMONTH_0"



as "MOIS",

"BPCINV_0"as "CLIENT",

........



SQL SELECT *



FROM

v140.AUTO.XCUMARTCLI INNER JOIN v140.AUTO.BPCUSTOMER ON v140.AUTO.XCUMARTCLI.BPCINV_0 = v140.AUTO.BPCUSTOMER.BPCNUM_0 WHERE ((v140.AUTO.BPCUSTOMER.REP_0)= ' here the Variable v ' AND XYEAR_0 > 2008)";

Thanks for your answers.



1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hello,

You can force the user to enter a value and then process it in the SQL statement:

LET vWhere = Input('Condition', 'Warning'); LOAD *;SQL SELECT *FROM TableWHERE Condition = $(vWhere);


Take into account that you will have to pass a value for this variable while reloading unattended.

Hope that helps.

View solution in original post

3 Replies
Miguel_Angel_Baeyens

Hello,

You can force the user to enter a value and then process it in the SQL statement:

LET vWhere = Input('Condition', 'Warning'); LOAD *;SQL SELECT *FROM TableWHERE Condition = $(vWhere);


Take into account that you will have to pass a value for this variable while reloading unattended.

Hope that helps.

Not applicable
Author

Thanks a lot !!!!

thats work fine 🙂

Not applicable
Author

You can go for Macro. Set a trigger for variable onchange event. In its macro function force ActiveDocument.Reload.

But macros have issues with server, hence if your app goes to server then this method is not prefered one.