I cannot get nested lookups working in forms

  • 10 March 2017
  • 7 replies
  • 10 views

Badge +1

Does anyone have a working example of a nested lookup in forms? The documentation says its possible but provides no examples.

Below are the 2 lookups that I need to nest:

lookup("Regional Media Radio CPP", "Active", true , "30 Rec AMDRV")

lookup("Regional Media Radio CPP", "Market", Market , "30 Rec AMDRV", true)

This is what I have tried:

lookup(lookup("Regional Media Radio CPP", "Market", Market , "30 Rec AMDRV", true), "Active", true , "30 Rec AMDRV")

Any assistance would be greatly appreciated happy.png


7 replies

Userlevel 5
Badge +14

could you explain you mean with nesting? ie. how does result of one lookup relates to the other.

if you could provide an example what's your input data (including datatypes) and what do you  want to lookup for it would be helpfull as well.

the way you "nested" lookup means inner lookup returns name of list outer lookup should get data from.

furthermore, result of lookup function is something like "ID;#Value" which is usually not directly usable as lookup value.

Badge +1

"Lookup functions can be nested inside of other lookup functions. Lookup functions will evaluate inside out, (for example, a lookup function inside another lookup function will evaluate first) to maintain formula correctness."

Above is from the Nintex documentation: http://help.nintex.com/en-US/nintex2013/help/#Forms/RootCategory/Designer/Nintex.Forms.LookupFunction.htm?Highlight=look… 

I have a list ("Regional Media Radio CPP") with several columns. The columns of interest are "Market", which contains the name of a city, "Active" which is a bool that designates the current/active entry for the designated "Market" (as there are multiple entries for each market...I need to find the single "active" item for a specified market). What I need returned is "30 Rec AMDRV" 

Thanks happy.png

Userlevel 5
Badge +14

what's meant with nesting lookup functions in docu is that you can resolve several lookups in a chain/cascade.

eg. if you had list of cities and a city lookup column in regional media list, you could first lookup a city by name to get city ID as inner lookup and then lookup regional media item by city ID as outer lookup.

however, what you effectively need in your case is lookup being filtered by two columns (Market, Active) which is unfortunately not possible with lookup function.

you can look eg. here   for some hints on workarounds in forms.

other option would be to implement lookups in workflow if that's suitable for your case.

Badge +1

Thanks for that! Could you maybe show me an example of the scenario in your first paragraph? I have tried several different scenarios including the one you mentioned and I can seem to get the syntax right. Where does the inner lookup sit inside the outer look? 

Keeping it simple; if you were to have an inner lookup in the following, where would it sit?

lookup(“listA”, “Title”, “Task1”, “ID”)

Userlevel 5
Badge +14

in general you can place inner lookup in place of any input parameter, you just need to understand what parameter value is expected and parse it properly out from lookup() function result.

as I've mentioned, the most common scenario is that you get value being looked up for from another lookup.

overall formula could look like this then

lookup(“listA”, “Title”, parseLookup(lookup('TaskList','TaskAssignedTo','domainuser','TaskTitle'),true), “ID”) 

 

Badge +1

Nice one! I will have a play and see how I go. Thank you so much for your help happy.png

Userlevel 5
Badge +14

so enjoy your new toy happy.png

if you've got answered your original question, close the thread by marking correct answer.

Reply