Skip to main content
Nintex Community Menu Bar

Query list to get whole column

  • July 18, 2018
  • 4 replies
  • 15 views

Forum|alt.badge.img+1

Hello All!

I would like to create workflow using two separate lists.

First list, on which this workflow is based, is used to trigger actions (notifications, Flexi tasks, lists updates etc.)

Second list is used to store users names an other informations (like status of approval, actions).

I need to query second list to get all names(e-mail) and assign Flexi task based on them.

And here is my problem: i'm using "for each" loop, but i only get one name (first one) as result of list query.

First step in my workflow is to query "Names" list to get all ID's.

Next i take those ID's as "For Each" loop parameter, and in this loop i have second "Query list" control, to query names based on ID's ( i setup filter to choose smaller or equal to ID's)

Could you please help me with this problem?

Regards,

Maciej

4 replies

Forum|alt.badge.img+1
  • Author
  • July 19, 2018

I found a mistake in my workflow, i forgot to set variable as collection....


Forum|alt.badge.img+11
  • Scholar
  • July 19, 2018

Hi Maciej Flis

Inside your For Each loop, the query list will retrieve one value only as you have a filter for ID. If you are overwriting the same variable with the email Id's retrieved from the list, then at the end you will be left with 1 Id in that variable.

See if this corrects your issue.


Forum|alt.badge.img+14
  • Scholar
  • July 19, 2018

First step in my workflow is to query "Names" list to get all ID's.

Next i take those ID's as "For Each" loop parameter, and in this loop i have second "Query list" control, to query names based on ID's

well, that's a bit overcomplicated.

you do not need to query the same list twice. query the list for all the columns you will need later in a workflow with a single action before the loop.

but i only get one name (first one) as result of list query.

that's a typical case if you store Query list action result set into a scalar variable(s) (single line text, number, etc..)

if query list may possibly return more then one item, you have to store result set into a collection variable. each single column you query for into a separate collection variable.

I need to query second list to get all names(e-mail) and assign Flexi task based on them.

if you want to assign a single task to all the users from the other list, you even do not need a loop action at all.

just query for all the names/mails (store them into a collection as mentioned above) and then configure task action's assignees the directly to the variable


Forum|alt.badge.img+14
  • Scholar
  • July 20, 2018

Great!

Please mark correct answer.