Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
dirk_fischer
Creator
Creator

Building criteria string for mixmatch function

Hi Folks,

I'm getting tired of squashing my head against the Qlik Sense code wall and hope, somebody can give me the necessary hints.

I try to build a criteria string for using in a MixMatch function in a where condition.

For this I use a Loop and extract the values I want to filter for into a variable

Let vSensorMeasurement = Peek('SENSOR_MEASUREMENT_' & Num($(vCntSensorResult), '00'), $(vCntRule), 'RULES_TO_ANALYSE');

Then I add the value of the variable to my condition string

Let vCondition = '$(vSensorMeasurement )'

In the next Loop, I combine the previous value with the newly extracted value

Let vCondition = '$(vCondition)' & ',' & '$(vSensorMeasurement )'

vCondition contains then  values like  FlpLAnaPhROI1,R_Highrun

But for the MixMatch function to work, I need the variable content to look like 'FlpLAnaPhROI1','R_Highrun'

Í tried adding Chr(39), but this leads to FlpLAnaPhROI1'',''R_Highrun and does not work either.

I tried Replace and everything else I could think of, but everytime I try to add the Chr(39), QlikSense makes a '' out of it and if I try to use a different string literal like Chr(34) or [], I just get empty results.

It would be great to get a Suggestion how to overcome this challenge.

Thank you very much for your help.

Best regards,

Dirk

Labels (4)
1 Solution

Accepted Solutions
dirk_fischer
Creator
Creator
Author

I tried the double quotes as well as [] but without success.

 

Adding Chr(39) I did like shown below

 

Let vCondition = Chr(39) & '$(vCondition)' & Chr(39) & ',' & Chr(39) & '$(vSensorMeasurement)' & Chr(39).

In the end I gave up today in the morning and went for creating a table, where I add the values of vSensorMeasurement to a column CRITERIA and then do an Where Exists(CRITERIA, SENSOR_MEASUREMENT) for filtering.

 

This is working fine and has additional advantages, because I can create the expected table name after the generic load. In the end, it makes creating mapping tables from the automatic created tables easier.

View solution in original post

2 Replies
hacr
Creator
Creator

 Did you try to make double quotes '' ? Seems like you tried most from thist post:

 

https://community.qlik.com/t5/Qlik-Design-Blog/Escape-sequences/ba-p/1469770

 

Where did you add the Chr(39) to get your stated result ?

dirk_fischer
Creator
Creator
Author

I tried the double quotes as well as [] but without success.

 

Adding Chr(39) I did like shown below

 

Let vCondition = Chr(39) & '$(vCondition)' & Chr(39) & ',' & Chr(39) & '$(vSensorMeasurement)' & Chr(39).

In the end I gave up today in the morning and went for creating a table, where I add the values of vSensorMeasurement to a column CRITERIA and then do an Where Exists(CRITERIA, SENSOR_MEASUREMENT) for filtering.

 

This is working fine and has additional advantages, because I can create the expected table name after the generic load. In the end, it makes creating mapping tables from the automatic created tables easier.