Pass Multi Select IDs to Another List and Return a Record for Each ID in Nintex Form


Badge +2

I am tasked with displaying courses that were chosen from another list in my form.

1. The user selects the record from a dropdown.

2. I used a calculated value to get the multi selected courses for the selected record.

3. I used a calculated value to get the values from the multiselect returned in the first calculated value.

9966iDF6E9B0574143606.png

The problem is that only the first id values are returned. I am using if statements in the second calculated value but I think that is not the correct option.

If(contains(calculatedCourses,'[4;') || contains(calculatedCourses,',4;'),"Course:"+lookup("Training Types","ID","4","Display Name")+" Hours:"+lookup("Training Types","ID","4","Hours")+" Student/Teacher Ratio:"+lookup("Training Types","ID","4","StudentTeacherRatio"),
If(contains(calculatedCourses,'[17;') || contains(calculatedCourses,',17;'),"Course:"+lookup("Training Types","ID","17","Display Name")+" Hours:"+lookup("Training Types","ID","17","Hours")+" Student/Teacher Ratio:"+lookup("Training Types","ID","17","StudentTeacherRatio"),""))

Does anyone know what I should be doing to get the values from each id in the multiselect field returned?

 


10 replies

Badge +2

I have successfully pulled multiple values from the course list but I am now receiving an error of "Too many async functions" when I add all of the If statements I need.


 


I need to create 33 different IF statements with unique values. I shortened the code below for an example. 


If(contains(calculatedCourses,'[4;') || contains(calculatedCourses,',4;'),"Course:"+lookup("Training Types","ID","4","Display Name")+" Hours:"+lookup("Training Types","ID","4","Hours")+" Student/Teacher Ratio:"+lookup("Training Types","ID","4","StudentTeacherRatio")+"</br>","")+
If(contains(calculatedCourses,'[5;') || contains(calculatedCourses,',5;'),"Course:"+lookup("Training Types","ID","5","Display Name")+" Hours:"+lookup("Training Types","ID","5","Hours")+" Student/Teacher Ratio:"+lookup("Training Types","ID","5","StudentTeacherRatio")+"</br>","")+
If(contains(calculatedCourses,'[10;') || contains(calculatedCourses,',10;'),"Course:"+lookup("Training Types","ID","10","Display Name")+" Hours:"+lookup("Training Types","ID","10","Hours")+" Student/Teacher Ratio:"+lookup("Training Types","ID","10","StudentTeacherRatio")+"</br>","")+
If(contains(calculatedCourses,'[11;') || contains(calculatedCourses,',11;'),"Course:"+lookup("Training Types","ID","11","Display Name")+" Hours:"+lookup("Training Types","ID","11","Hours")+" Student/Teacher Ratio:"+lookup("Training Types","ID","11","StudentTeacherRatio")+"</br>","")+
If(contains(calculatedCourses,'[12;') || contains(calculatedCourses,',12;'),"Course:"+lookup("Training Types","ID","12","Display Name")+" Hours:"+lookup("Training Types","ID","12","Hours")+" Student/Teacher Ratio:"+lookup("Training Types","ID","12","StudentTeacherRatio")+"</br>","")+
If(contains(calculatedCourses,'[13;') || contains(calculatedCourses,',13;'),"Course:"+lookup("Training Types","ID","13","Display Name")+" Hours:"+lookup("Training Types","ID","13","Hours")+" Student/Teacher Ratio:"+lookup("Training Types","ID","13","StudentTeacherRatio")+"</br>","")+
If(contains(calculatedCourses,'[14;') || contains(calculatedCourses,',14;'),"Course:"+lookup("Training Types","ID","14","Display Name")+" Hours:"+lookup("Training Types","ID","14","Hours")+" Student/Teacher Ratio:"+lookup("Training Types","ID","14","StudentTeacherRatio")+"</br>","")+
If(contains(calculatedCourses,'[16;') || contains(calculatedCourses,',16;'),"Course:"+lookup("Training Types","ID","16","Display Name")+" Hours:"+lookup("Training Types","ID","16","Hours")+" Student/Teacher Ratio:"+lookup("Training Types","ID","16","StudentTeacherRatio")+"</br>","")+
If(contains(calculatedCourses,'[17;') || contains(calculatedCourses,',17;'),"Course:"+lookup("Training Types","ID","17","Display Name")+" Hours:"+lookup("Training Types","ID","17","Hours")+" Student/Teacher Ratio:"+lookup("Training Types","ID","17","StudentTeacherRatio")+"</br>","")+
If(contains(calculatedCourses,'[35;') || contains(calculatedCourses,',35;'),"Course:"+lookup("Training Types","ID","35","Display Name")+" Hours:"+lookup("Training Types","ID","35","Hours")+" Student/Teacher Ratio:"+lookup("Training Types","ID","35","StudentTeacherRatio"),"")

I tried this option. I have multi-select lookup control (check box list) and 20 items in a lookup list. When I select items 1-10, this function returns a correct value from the associate column. But when I select items from 11-19, this function returns values 1-9 and 11-19. 


If(contains([LookupColumn],'1;') || contains([LookupColumn],',1;'),lookup("SAP Module","ID","1","AssociatedUsersName")+"; ","")+
If(contains([LookupColumn],'2;') || contains([LookupColumn],',2;'),lookup("SAP Module","ID","2","AssociatedUsersName")+"; ","")+
If(contains([LookupColumn],'3;') || contains([LookupColumn],',3;'),lookup("SAP Module","ID","3","AssociatedUsersName")+"; ","")+
If(contains([LookupColumn],'4;') || contains([LookupColumn],',4;'),lookup("SAP Module","ID","4","AssociatedUsersName")+"; ","")+
If(contains([LookupColumn],'5;') || contains([LookupColumn],',5;'),lookup("SAP Module","ID","5","AssociatedUsersName")+"; ","")+
If(contains([LookupColumn],'11;') || contains([LookupColumn],',11;'),lookup("SAP Module","ID","11","AssociatedUsersName")+"; ","")+
If(contains([LookupColumn],'12;') || contains([LookupColumn],',12;'),lookup("SAP Module","ID","12","AssociatedUsersName")+"; ","")+
If(contains([LookupColumn],'13;') || contains([LookupColumn],',13;'),lookup("SAP Module","ID","13","AssociatedUsersName")+"; ","")+
If(contains([LookupColumn],'14;') || contains([LookupColumn],',14;'),lookup("SAP Module","ID","14","AssociatedUsersName")+"; ","")+
If(contains([LookupColumn],'15;') || contains([LookupColumn],',15;'),lookup("SAP Module","ID","15","AssociatedUsersName")+"; ","")

 


If I select an item with ID 14, this formula returns values of ID 4 and 14. 


 


Is there any issue is this formula? 

Badge +2
Use equals instead of contains.

So that in the equals formula, I will need to pass the entire string.


 


If(equals([LookupValue],'13;#XYZ') || equals([LookupValue],',13;#XYZ'),lookup("SAP Module","ID","13","AssociatedUsersName")+"; ","")


 


If so, I cannot do this as the values ("XYZ") can be changed in the future. 

Badge +2
If you use parseLookup(trainingID,false) it will return the values without the extra text. It will return only the values displayed in the dropdown.


I have checkbox list like this will it work for this as well?

Badge +2
Yes.
Badge +2
Use parseLookup instead of LookupValue.

I have a multi-select control. 



@mcrumgis : 


I tried the below condition:


If(equals(parseLookup([LookupField],false),'1'),lookup("SAP Module","ID","1","AssociatedUsersName")+"; ","")+
If(equals(parseLookup([LookupField],false),'2'),lookup("SAP Module","ID","2","AssociatedUsersName")+"; ","")+
If(equals(parseLookup([LookupField],false),'3'),lookup("SAP Module","ID","3","AssociatedUsersName")+"; ","")+
If(equals(parseLookup([LookupField],false),'4'),lookup("SAP Module","ID","4","AssociatedUsersName")+"; ","")+
If(equals(parseLookup([LookupField],false),'5'),lookup("SAP Module","ID","5","AssociatedUsersName")+"; ","")

But It is not working. In the paseLookup value is like [2,12], and for this again, I think I will have to use contains function, I guess. 


Can you please suggest?

Badge +2
I used ; as part of the query for contains. You will have to find a way to tell the code which value is unique. Ex: If(contains([LookupColumn],'1;')
I used the ; which makes 1; different from 11;. Look at the values that are returned and find a way to make them different then you can use contains.

Reply