Query List Item ID to populate List Item control


Badge +4

Hello there,

I'm a Nintex newbie so bear with me.

I have two forms. The first list is called Monitor Tracking - Classic and the second list is called UFF Tracking - Classic. I want to populate fields based on a lookup function that pulls column data from the first list. The user will type in a known number into a field named "Monitor Number". Typing this in, should pull the data from the first list that matches the Monitor Number. I noticed that the Classic form has a control called "List Item". Here's how I attempted to use it. Anyone know what I'm doing wrong? Or will this form control not accomplish what I'm looking to do?

  1. I created a Form Variable named Monitor_Item_ID with a lookup formula that will pull the value from the list item's ID column:   lookup("Monitor Tracking - Classic", "Monitor Number", Monitor_Number, "ID")Form Variable screenshot
  2. I then added the List Item control to my form. Edited the control settings. It seems as though the List Item ID field in the control properties wants a number because I get this error if I type in the form variable name.
  3. So then I tried to use the GetStringQuery formula to pull the ID. It did not give me an error so I had high hopes that it would work. I set the Advanced settings to show an error if the list item doesn't exist to aid in troubleshooting.
  4. However, when I click Preview and type in a known good number into the Monitor Number field and tab to the next field to trigger the runtime refresh, the List Item doesn't populate.
  5. So I thought maybe it won't work in preview mode so I save and publish my form. Then click New Item and populate the Monitor Number field. Unfortunately I get the error that the list item with zero doesn't exist.

So this leads me to believe that my formula in the "List Item ID" isn't correct. Help!

UPDATE: I just had a thought and decided to validate that my "Form Variable" is working. So I used the same lookup syntax as I did in the form variable at the beginning of my post. I put it into a Calculated Field instead so I could actually see the value that it pulls. Unfortunately after I type in the Monitor Number and tab to the next field, I can see the calculated field "Loading..." but then it doesn't return any value. Ugh.

UPDATE #2: I fixed the Form Variable. I changed the formula to:  

lookup("Monitor Tracking - Classic", "ID", Monitor_Title, "ID")

and now it pulls the list item ID. But it's still not populating the List Item control based on the GetQueryString formula.

Oh and if anyone has a better way of achieving this, please let me know. I could just use several Calculated Value controls to pull the data from the other list but I thought maybe the List Item control would be easier.


3 replies

Userlevel 5
Badge +14

unfortunately, List Item control doesn't support dynamic filtering at runtime.

it only supports specifying static list item ID value at design time (therefore that error asking to provide a numeric value) or it can take over a value from Item properties (but that's as well evaluated just when form is loaded)

I'd suggest to use List View control, which support dynamic filtering at runtime

So then I tried to use the GetStringQuery

that function takes over a token value from URL, so you should have had a token like '....&Monitor_Item_id=12345' in URL to make it working

lookup("Monitor Tracking - Classic", "ID", Monitor_Title, "ID")

this lookup doesn't make too much sense, it return the same (ID) value that you filter by (ie. have in Monitor_Title control)

Badge +4

Thank you Marian! Helpful information. And you're right, that lookup does NOT make sense. But for some reason it works. I got the idea from Tom Shirley's blog. I would never have thought to put "ID" as the lookup column. Oddly enough that was the fix. So I ended up using multiple Calculated Value fields using that lookup formula and just changed the last part of the formula to pull in the various column info for a particular list item.

Example:

lookup("Monitor Tracking - Classic", "ID", Monitor_Title, "ID")

lookup("Monitor Tracking - Classic", "ID", Monitor_Title, "Title")

lookup("Monitor Tracking - Classic", "ID", Monitor_Title, "Program")

Userlevel 5
Badge +14

great!

please mark correct answer if it addressed your problem.

Reply