Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

Not applicable

Create concatenated string variable

Hi All,

I have a problem that I hope someone can help me solve. I have a dashboard that displays trade information. The users have a list of CUSIPs - just strings - that they want to use to either use as the search condition or use as a list to exclude in the search. The don't always want to apply this filter, so it should be a button/check box.

For the first case, I tried to create a list of CUSIPs from the user table delimited by a pipe in order to use a Select in Field action. Here is my code in the load script:

let vCusipList = Text(peek('CUSIPtoExclude',1)) ;

FOR i=2 to NoOfRows('ExcludeCUSIP')

  let vCurrent = Text(peek('CUSIPtoExclude',i));

  set vCusipList = $(vCusipList) & '|' & $(vCurrent);

Next i

It appears that this code is running correctly in debug, but I can't display the final value of vCusipList. Is there a limit to the lenght of a variable? There are over 400 CUSIPs in the list.

I don't have any good ideas for the exclusion.

Any ideas welcome.

1 Solution

Accepted Solutions
MVP
MVP

Re: Create concatenated string variable

if you have a list of excluded I think you can use a button with 2 actions

- select in field ....

- select excluded

5 Replies
MVP
MVP

Re: Create concatenated string variable

if you have a list of excluded I think you can use a button with 2 actions

- select in field ....

- select excluded

Re: Create concatenated string variable

Weird. The SET statement cannot produce a correct value, as it will treat everything after the equal sign as text. And this doesn't depend on whether you are running in debug mode or not.

In your Load Script Loop, change the SET into a LET and see what happens.

Re: Create concatenated string variable

Or keep the SET keyword, but write the right-hand part like this:


SET vCusipList = $(vCusIpList)|$(vCurrent);

$-sign substitution will still work. It always works...

Not applicable

Re: Create concatenated string variable

Massimo - Your solution is working. I added a Clear Field and then Select Possible action before my Select in Field action in my button and it is working fine.

Peter - Let gives me this error:

             Script line error:

             let vCusipList = '(' & (543495857|543495832) & '|' & 543495717 & ')'

Set seems to work, but it appears that the size limit for variables is reached. I don't have time to explore this solution.

Re: Create concatenated string variable

The script line error is caused by the vertical bar between two large numbers. Vertical bar is no known operator. You have to turn everything into a string for the concatenation operators to work.

As far as I know, there is no size limit for variables. To verify this, I ran a script that doubled the string content of a variable in a loop that ran 10**7 times. It kept going for three weeks without error ,and then I got tired.

There may be a search field size limit though. Didn't test that (yet)...

Community Browser