Recovering a long list of selected (or possible) values

If a user selects too many values from a field (dozens of stations, for example), the regular approach will not work. Instead, it will generate an error because the variable that handles the selection becomes too long.

The way to work around this is by populating a table with all values, so you can use a regular concatenation script to retrieve all values. The script can be generated as follows: 

StartStations:
LOAD concat(Station,chr(39)&','&chr(39)) as concatenated_stations Inline [
Station
$(odso_start_station_name){"quote": "", "delimiter": ""}
];
Let vStartStations='';
if NoOfRows('StartStations') > 0 then
LET vStartStations = chr(39)&Peek('concatenated_stations')&chr(39);
Endif
Drop Table StartStations;

In this script, we're generating an inline table with all values passed into our binding variable. We then apply a concat function that joins all values, separated by commas. Finally, we check whether there is at least one selected value, which creates a variable that contains a string with all values.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset