question

Hemanth Sai Kumar avatar image
0 Likes"
Hemanth Sai Kumar asked Jason Lightfoot edited

Pull from list on query


Hi Community ,

I have a use case where I am trying quire a custom pull of items from a global list where I have 3 conditions to check if it fails don't pull anything. I am getting error and I am unable to find where my code is going wrong.

Error :

time: 4.000833 exception: FlexScript exception: Could not parse query Select from PartList_feeder WHERE str == st ORDER BY Age Desc at MODEL:/Tools/ProcessFlow/VPI flow/Pull from List>variables/query

time: 4.000833 exception: Exception caught in start() of activity "Pull from List" in process flow "VPI flow". Continuing throw...

time: 4.000833 exception: Exception caught in Executive::processeventinlist().


Below is the snip of my case
1722261228783.png

Any feedback on what SQL Query should I use.

FlexSim 24.1.1
pull from listsql queries
1722261228783.png (272.0 KiB)
· 6
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Logan Gold avatar image Logan Gold ♦♦ commented ·

Hi @Hemanth Sai Kumar, was Jason Lightfoot's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·
Hemanth Sai Kumar avatar image Hemanth Sai Kumar Logan Gold ♦♦ commented ·

Hi Logan,
Thank you for the follow up on the above error, I tried writing the below syntax by @Jason Lightfoot I am still getting the same error.

1722574658949.png

1722572949203.png

0 Likes 0 ·
1722572949203.png (4.8 KiB)
1722574658949.png (21.3 KiB)
Joerg Vogel avatar image Joerg Vogel Hemanth Sai Kumar commented ·

@Hemanth Sai Kumar Jason has demonstrated how to compose a string. Please assign this string into a string variable. You insert this string variable into your query. If you add this string directly into your query method, then the string ends by second occuring double quotation mark and a plus sign and a second string is not a correct parameter setting for a query method. You can parse only ONE string into this method.

0 Likes 0 ·
Show more comments

1 Answer

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jason Lightfoot commented

You are comparing a field called str with another called st - not the local variables if that's what you inteneded.


To compare the field str with the local variable st you can concatenate the string surrounded by single quotes or pass the st value in as a parameter.

Also note that comparisons in FlexQL can be done with a single =.

· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Hemanth Sai Kumar avatar image Hemanth Sai Kumar commented ·

Hi @Jason
Thanks for the Prompt Reply,
I tried changing the string into single quote and now I am getting a new error

Error

time: 4.000833 exception: Exception caught in start() of activity "Pull from List" in process flow "VPI flow". Continuing throw...

time: 4.000833 exception: Exception caught in Executive::processeventinlist().

Any feedback on what SQL Query should I use.

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Hemanth Sai Kumar commented ·
"SELECT * FROM PartList_feeder WHERE str='"+st+"' ORDER BY Age DESC"
0 Likes 0 ·