Query of Second Occurrence of 'For Each Loop' does not work

  • 15 November 2018
  • 2 replies
  • 50 views

Badge +7

Hello,

I have been trying to get this to work for weeks.  I have read numerous posts on the subject, but cannot get this to work.

I have created a collection of collateral types called vCollCollateralList based on a multi value column.  Then, I want to use each collateral type and query another list (Checklist Template) to create a checklist.  The second collection is called vCollStepName.

I do this with a For Each loop on vCollCollateralList and I store result in itemCollateralType.  Then I query a list called 'Checklist Template' with filter set to Collateral Type is equal to itemCollateralType (from the For Each Loop) and save in a collection called vCollStepName.  Then I do a count of vCollStepName to make sure I picked up steps.

The first occurrence (first collateral type) of this works fine, but when it loops around the second time, I know the 'For Loops' picks up the value of the 2nd collateral type correctly (as shown in History Log), but when I use the second collateral type to query Checklist Template, it does not find anything. 

Example: I have 3 Collateral types - CHT, EMV, ENL.  Each of these has 3 steps in 'Checklist Template'.

First loop - retrieves 3 steps for CHT

Second Loop - retrieves 0 steps for EMV

Third Loop - retrieves 0 steps for ENL

If I remove CHT, and run the same thing for EMV, ENL

First loop - retrieves 3 steps for EMV

Second Loop - retrieves 0 steps for ENL.

Does this make sense?  Any ideas?  Thanks in advance for your help!


2 replies

Userlevel 5
Badge +14

I have created a collection of collateral types called vCollCollateralList based on a multi value column. 

likely multivalue column separates single values with a comma/semicolon + a space.

if you turn multivalue column into a collection with a regular expression by an item separators, space characters are left there. and these cause your filter condition do not match any items.

Badge +7

Marian,

Oh my gosh.  You were exactly right.  I used trim to remove the spaces and it worked perfect.  Thank you so much!

Reply