How do you use 'Calculated Value Lookup' with a list with multiple-selections?


Badge +1

I can't seem to find any working examples of how to perform a calculated value lookup that loops for each option selected in a multiple-selection list lookup.

I have a list called 'Department List' in SharePoint 2013 that contains a list of departments, in a column called 'Departments', and a few lines of department specific text in a column called 'Add to email'.

On my form I have a List Lookup Control called 'InvDel', that uses the Department List as a source, and displays all the departments from the list as check-boxes. This generates when the form is loaded, based on how many departments I have in the list, which is exactly what I want.

I then have a 'calculated value' control, called 'Text to email'. My aim is to populate this field with the text from the 'Department List' list depending on which check-boxes have been selected by the user. This is where I am having trouble. I've tried every combination, and I can't get my calculated value lookup formula to return more than one result. 

If I use the formula: InvDel it returns the each ID, and the name of each Department that has been selected.

If I use the formula: lookup("Department List","Department",parseLookup(InvDel),"Text to email") it returns only the first check-box the user has selected, but none thereafter.

How do I amend the formula to work for all the other selected check-boxes?

Many thanks, in advance.


2 replies

Badge +1

I've just seen the following text:

"The lookup function does not currently support multiple values being passed in as the input value parameter. Only a single value is supported. I.e. you cannot pass an array of values into a lookup function."

Taken from the Nintex page: Runtime functions 

Does that mean I am trying to accomplish the impossible (impossible as far as OOTB)?

Badge +1

It's not ideal, but I am now using the following formula in the Calculated Value control to achieve what I want:

If(contains(InvDel,1),Lookup("Involved in Delivery","ID","1","Add to email"),"") +
If(contains(InvDel,2),Lookup("Involved in Delivery","ID","2","Add to email"),"") +
If(contains(InvDel,3),Lookup("Involved in Delivery","ID","3","Add to email"),"")... etc etc

I have to repeat the same line of code for each check-box that could be ticked, which is each row of my SharePoint List.

I suppose my new question is whether or not I can use an array to generate this code for me?

Reply