Skip to main content

Hello Celopeers.

 

I have a variable that is a list based on a dropdown component.

The end result looks something like this:

'0014','0191','0311'

 

Now I want to pull a specific value from this variable.

Problem is, that any function calling it is either pulling only the first value, or doesn't really give me the value I need (in this case a second or third value)

 

Examples I tried already:

1.

Input:<%= VARIABLE%>

Output: 0014

 

2.

Input: RIGHT(<%= VARIABLE%>,4)

Output: Error, Operator 'RIGHT' requires 2 inputs but 4 were provided.

 

3.

Input: CONCAT(<%= VARIABLE%>)

Output: 001401910311

 

4.

While combining the RIGHT or LEFT with CONCAT might be able to be helpful enough with some tweaks if the variables had all the same length, they have varying length. some being 4 characters long, some up to 14.

Input: RIGHT(CONCAT(<%= VARIABLE%>),4)

Output: 0311

 

Therefore is there some way to call specific value from the list like in Python it would be:

Input: VARIABLEA1]

Output: 0191

 

Kindest regards

Marcin

Hello Marcin,

 

I would appreciate additional clarification regarding the specific scenario involving a "variable that is a list based on a dropdown component."

 

Text replacement variables serve the purpose of substituting characters within a PQL query before its evaluation.

 

For a deeper understanding of variable types, please refer to the documentation available at:

 

Variables Documentation

 

Thank you for providing more insights into this use case.


Hello Marcin,

 

I would appreciate additional clarification regarding the specific scenario involving a "variable that is a list based on a dropdown component."

 

Text replacement variables serve the purpose of substituting characters within a PQL query before its evaluation.

 

For a deeper understanding of variable types, please refer to the documentation available at:

 

Variables Documentation

 

Thank you for providing more insights into this use case.

Hi.

Im not sure how I can clarify it further so I'll provide screenshots which might be helpful.

 

I have a component (Button dropdown) that writes to a variable:

 

image.png 

The end result variable looks like this:

 

image 

Now I want to pull a certain value from that variable (lets say I want the third value so in this case "LIFSK") but no matter what I do as described in the post, it either gives me an error or just the first value:

 

image 

Kindest

Marcin


Maybe you can use STRING_SPLIT to split the variable into different parts and access via the index.


STRING_SPLIT ( '<%= VARIABLE_1 %>', ',', 1 )

You need to check the "Escape wrapping characters within values" probably.


STRING_SPLIT ( '<%= VARIABLE_1 %>', ',', 1 )

You need to check the "Escape wrapping characters within values" probably.

Thank You. It partially solved my problem.

 

For numeric values which was my original need it works perfectly.

For string values it gives a following error (Both with and without "Escape wrapping characters..." checked)

image 

 


Reply