This has been frustrating for me because it seems it should be simple. I have a form with a list lookup control that links to a parts list in the same site. The user can select a part number using that control. What I would like is to have a read-only text control that auto-fills the part description, based on the part number selected. Seems to me this formula would be the logical way to accomplish this:
Lookup("Parts", "Part Num", Form.Part, "Description")
...but Nintex does not allow me to insert a value from another control nor from a form variable into the Form.Part part of the formula. What am I missing?
You are pretty close in your formula. You just need to change one thing from what I can see. This is one I have that looks up the address for a customer.
However, for your scenario, since you want to match on "Part Num" for the lookup, you need to change the parseLookup to true, which will return the value in the field instead of the ID of the selected item in the drop-down. If your Part Num field is an integer, you will need to modify the parseLook to convert it to a number. For example, convertToNumber(parseLookup([Form].[Part Num],false)).
David - Thanks for your quick reply. parseLookup seems promising, but I'm running into the same roadblock. I cannot insert the list lookup control into the formula - it's not in the list of variables from which to choose (it only has SharePoint columns, Context, or Form mode), and if I try to type [Form].[SelectPart], the parser tells me "the function requires a 'string' type of parameter." and "Variable '[Form].SelectPart]' cannot be found." For simplicity, I'm just trying this:
...and I see those errors. It's almost as if there's something wrong with my list lookup control. (?)
Trying another approach, I created a form variable called varPart with the value [Form].[SelectPart], and that appears to work. Trouble is, I can't figure out how to make use of the form variable.
It sounds like what you have is correct. You might try wrapping your entire formula in a convertToString function. It seems like the data you are looking up might be a different data type than the field you are trying to populate. By wrapping your formula in the convertToString function, it will ensure it returns a string.
Is there something fundamentally wrong with my form? The documentation for parseLookup suggests that I can insert my list lookup control, but it won't accept any form of the blue parameter.
On mine, I think it should be [Form].[SelectPart], but there seems to be no [Form] object available to me.
One other point: This is a list form, not a workflow form, if that matters.
I'm getting closer, thanks to Euan Gamble's video (https://www.youtube.com/watch?v=aa1JM3vEhxY). I can do the lookup successfully in a form variable, then insert that variable into a label control. My formula is
lookup("Parts", "ID", parseLookup([Form].[SelectPart], false), "Description")
My remaining problem is that I would like that result to be in a bound control, so that it is saved to my list. Evidently, I cannot insert either that variable or that formula into a text control bound to the list's Description column (or even unbound). If you can have another suggestion, please share.
And, thanks for your help!