question

sara S2 avatar image
0 Likes"
sara S2 asked sara S2 commented

How to set the query in pull from list activity?

Hi,

I have to set the following query in “pull from list” activity according to a label "A" values (3, 4, 5):

A= 4 then A= 3 then A=5.

I can’t use “ORDER BY”, I think there is a way to do it by "WHERE". I set this query:

WHERE A=4, WHERE A=3, WHERE A=5

But this is invalid.

Would you please help me to write the convenient query.

Regards.

FlexSim 19.0.0
pull from list query
5 |100000

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

1 Answer

·
Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered sara S2 commented

That's not what a WHERE statement does. A WHERE statement is basically a yes or no. Can this entry be pulled? Yes or No?

If you want to change the order of things you pull you need to use an ORDER BY statement.

Also you can only use the WHERE keyword once. Your query would need to look like this:

WHERE A = 3 OR A = 4 OR A = 5 ORDER BY something 
· 8
5 |100000

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

sara S2 avatar image sara S2 commented ·

@Matthew Gillespie, thank you for your help.

0 Likes 0 ·
sara S2 avatar image sara S2 commented ·

In fact, "WHERE A = 4 OR A = 3 OR A = 5 " is not working as I expected. Here there is a choice between 4 or 3 or 5. But, what I want is "then" instead of "or". Pick Items of label “A” equal to 4 then Items having label “A” equal to 3 then Items having the label “A” equal to 5.

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ sara S2 commented ·

You can’t do that with just a WHERE statement. You need the ORDER BY part to enforce a certain order

0 Likes 0 ·
sara S2 avatar image sara S2 Matthew Gillespie ♦♦ commented ·

Okay, how should I do it with ORDER BY, please ?

0 Likes 0 ·
Show more comments
sara S2 avatar image sara S2 commented ·

@tanner.p, this isn't a simple ORDER BY, the order is: 4 THEN 5 THEN 3. So, how could I do it using ORDER BY?

0 Likes 0 ·
Regan Blackett avatar image Regan Blackett ♦ sara S2 commented ·
ORDER BY labelName = 4 DESC, labelName DESC

The first order by puts all the label values of 4 at the top, then sorts everything else from highest to lowest.

1 Like 1 ·
sara S2 avatar image sara S2 Regan Blackett ♦ commented ·

@Regan Blackett, thank you very much for your help. this is working perfectly.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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