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

variable in SQL

Hi at All,
in a menu I set a new variables called: loadf

if i set like a content of tjis variable Getfieldselection(vrs)
where vrs is a list box I'm able to see what is the value I selected in
listbox.
Now I would topass this variable in a script sql

load a, b, c from ..
where a= '$(loadf)';
In the log file I see
where a= 'Getfieldselection(vrs)'';
and doesn't work
Does exists a way ri ibtain in sql where the value I selected in List box?

Thamks
Best Regards
Slash

7 Replies
Anonymous
Not applicable
Author

Do you define loadf as
Getfieldselection(vrs)
or as
=Getfieldselection(vrs)
?

Not applicable
Author

I tried in either way.

the problem is Whree.. '= '

in the log the result is the same:

'Getfieldselections'

ot

GetfieldSelections

Ineed to pss the content of variables in he list I selected.

After I passed the value bt reload I would to chang the value of Where statement..

I think us a cool soluction... uf it works ...

Slash

Not applicable
Author

Some help ?

Not applicable
Author

when do you have many values you must use "where in " .

Anonymous
Not applicable
Author

First, Ivanidlo is right that you have to use in().
Second, you cannot use Getfieldsselections in the script - during the reload process, the fields don't exist yet, no mention the selections.
So, what you have to do is to capture the selections before the reload, format in a way usable in the script, and reload.

See attached, it works this way:
1. Make selections in field "vars".
2. click the reload button.
3. The field "a" will have only values selected in "Vars" before the reload.

Notice that the variable "loadf" is not changing on selections in "Vars" It changes by a macro "loadf".

Not applicable
Author

thanks but it semas doesn't work. I The button doesn't work I attached the button to a macro called "relod" but nothing happens .

the target I need is :

to capture the field select in a list box and pass this value, by vars, in ehere statement in script sql.

Thanks Regards,

Slash

Anonymous
Not applicable
Author

Forgot to mention - I created this demo in QV 9. The button calls two macros:
loadf - creates a variable for "where" clause
reload - reloads and saves.

If you're using older QV version, you have to combine these two macros in one.