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

Retrieve selected value in a selection list

Hello,

I have a selection list like this:

Capture.PNG.png

and i want to fill a variable with the value which is selected (blank, 'Jour.qvd' or 'Mois.qvd').

How can i do this?

I have tried GetCurrentSelections but this only works in expressions and not in the script so i don't know how to do this.

Does anyone have an idea please?

Thanks,

Best Regards,

Loïc

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

See this example.

Good luck,

Peter

View solution in original post

8 Replies
maxgro
MVP
MVP

try with

=only([Nom du fichier])

if you want to set the variablein the script

let variable='=only([Nom du fichier])';

giakoum
Partner - Master II
Partner - Master II

you can use concat or p (possible values). However, you need to fill the variable that then will be used in the next reload? is that the case?

Not applicable
Author

Are you trying to pass the variable from UI to script? or you have a field with these values and in you need your script to take these values and use it. if that is the case then try using FOR loop.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you want a selection in a list to influence script execution, then use an InputField and attach a variable to the field. Other lists based on fields will not survive the script start as the first thing the script will do is wipe the data model clean.

Good luck,

Peter

Not applicable
Author

the thing is, when i write this in the script:

set fichier = GetCurrentSelections([Nom du fichier]);

it doesn't execute the function GetCurrentSelections but like a simple string

All i want to do is to find a way to differentiate which value is selected because it must have another treatment.

If 'Jour.qvd' is selected, i have to execute some lines of my script and if 'Mois.qvd' is selected, i have to execute other lines of my script.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Well, your first remark boils down to the difference between SET and LET.

  • SET will treat everything behind the equal sign as text. Whetever you put there, it will not be evaluated. $-sign substitution however will take place as always. Note that strings don't need delimiters because everything is a string.
  • LET will treat everything behind the equal sign as part of an expression and evaluate the right hand side. Strings need delimiters to be treated like string.

Use the trick with the InputField to control script behavior. It's pretty simple and works lilke a charm.

Peter

Not applicable
Author

You cannot use, chart functions in the script. As Peter said, you have to create a input field and attach the [Nom du fichier] to this variable. and then pass this variable to script and use in IF and ELSE condition.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

See this example.

Good luck,

Peter