Home > Forum > Actions > For each Row item list in Control field

For each Row item list in Control field
0

Hello all,

I need to set up a control field where I want to check if the a specific column from an item list already exists in an external database.
The use case is the following:

Webcon process
1. Item List with Column Invoice Number
2. Number of rows can be more than one
3. timeout that will move to the control field to check if the invoice number exists in the external database
4. Process can only be moved to Finish if all the rows have a match

So this works, if I just have one row.
In the control steps, For Each is not available so I will probably have to check this using SQL command?

Does anyone have suggestions?
Thank you

MVP

Hi Andreia,

I'm a bit confused, why don't you have a "for each" in a path of the control step?

What I would do in your case:
- Create an "Action" column, with values: Verify, Exist, Doesn't exist
- Set the action to "Verify" for all rows.
- Create a "loop" using a flow control which either moves the workflow to the control step or to the finish step
- Get the top x rows of the item list with action "Verify"
- Determine whether it exists or not and set the action of those rows.
- Set a timeout on the control step, so that it gets triggered again.

This assumes, that it takes a long time to verify all rows which would cause a timeout and therefore would prevent the path transition to be executed.
If you can access the external database and the BPS content database with the same account, it will be easy to do. In this case you could use the update item list action.
Otherwise, if you need to use REST for example, you need to use the for each operator and a "any collection". This could return the invoice number. In the for each loop you could store the result in a parameter. The parameter would be build like a "multi value choose field" "invoice number1#Doesn't exist;invoice number2#Doesn't exist". After the foreach you could then use the parameter value to update the item list.

If you do have questions and have time tomorrow 5pm CEST, you could join my Ask Me Anything YouTube live event and we may be able to clarify this.
https://www.youtube.com/watch?v=okx0Wr_q0IM

Best regards,
Daniel

In reply to: Daniel Krüger (Cosmo Consult)

Hi Andreia,

I'm a bit confused, why don't you have a "for each" in a path of the control step?

What I would do in your case:
- Create an "Action" column, with values: Verify, Exist, Doesn't exist
- Set the action to "Verify" for all rows.
- Create a "loop" using a flow control which either moves the workflow to the control step or to the finish step
- Get the top x rows of the item list with action "Verify"
- Determine whether it exists or not and set the action of those rows.
- Set a timeout on the control step, so that it gets triggered again.

This assumes, that it takes a long time to verify all rows which would cause a timeout and therefore would prevent the path transition to be executed.
If you can access the external database and the BPS content database with the same account, it will be easy to do. In this case you could use the update item list action.
Otherwise, if you need to use REST for example, you need to use the for each operator and a "any collection". This could return the invoice number. In the for each loop you could store the result in a parameter. The parameter would be build like a "multi value choose field" "invoice number1#Doesn't exist;invoice number2#Doesn't exist". After the foreach you could then use the parameter value to update the item list.

If you do have questions and have time tomorrow 5pm CEST, you could join my Ask Me Anything YouTube live event and we may be able to clarify this.
https://www.youtube.com/watch?v=okx0Wr_q0IM

Best regards,
Daniel

Hi Daniel,

Thank you for your answer.
My idea was to set up something that I have already in another process and where I need to cross form fields information with an Oracle table.
Basically I'm using Data Source Value, and if it return empty, then it means that it didn't find any relation.

For this case, I'm taking your suggestion for the Action column, but I was trying to make the comparison inside the control step. And for control steps, the options built-in for Item list does not contain a for each operator. So trying with your suggestion, what would you use to check that instance can be closed or moved back?
Thank you