Home › Forums › SPJS-Lookup › Look up values for multiple columns DFFS
- This topic has 5 replies, 3 voices, and was last updated 8 years, 5 months ago by Alexander Bautz.
-
AuthorPosts
-
-
February 16, 2016 at 02:39 #10275
Hi Alexander,
Can you please provide the correct syntax to use multiple lookup columns on a form?
I’ve tried different variations, drop-downs are showing but no values are provided.
The single drop-down value for “CompanyName” worked perfectly.This is an example of what I’ve tried
“fieldToConvertToDropdown”:[“CompanyName”,”PositionTitle”],
“listName”:”Tasks”,
“listBaseUrl”:”/Sites/MySite”,
“optTextFieldInternalName”:”CompanyName”,”Position”,
“sortFieldName”:”CompanyName”,”Position”,The error I’m receiveing:
[LookupInTextField: Debug]
1.11
ListName: Tasks
Query: <Where><IsNotNull><FieldRef Name=’CompanyName,Position’ /></IsNotNull></Where><OrderBy><FieldRef Name=’CompanyName,Position’ Ascending=’TRUE’/></OrderBy>
ViewFields: ID,CompanyName,Position
Query returned -1 items.Thanks for your help.
-
February 17, 2016 at 23:43 #10299
Hi,
It is only the “fieldToConvertToDropdown” parameter that should contains multiple field names. This means you must use only one field name in “optTextFieldInternalName” and “sortFieldName”.When using multiple fields in “fieldToConvertToDropdown” you basically create multiple identical lookups in different fields in the form.
If what you wanted was to add multiple DIFFERENT lookups, you must duplicate the entire function call – with the argument object.
Hope this helps,
Alexander -
June 18, 2016 at 05:42 #12014
Hi
I have been using the Lookup function for a while and have it working fine on a library that contains documents received from various companies. The current process is that a file is added to the library, and then the user fills out the form to update the metadata for that new item.
Company Name is one of the metadata fields, and it is a SLOT which is use the Lookup function on querying the Companies list to get a list of all possible companies in a dropdown which the user can select which one.
I have now realised that since the company name is the first part of the file name, I could parse the file name and automatically populate the Company Name field for the user. I have now added a “Parse File Name” button on the form which calls a custom function to parse the file name and extract the company name.
This all works, and it also updates the field but the form field does not get updated. ie the Company Name field still displays the default value of “select company”, but after saving the form, the real Company Name is displayed in the list, and will appear in the form when editing it. (I am using the setFieldValue function to set the company name field)I also get a couple of other parameters from the file name, such as a Reference, which is just a SLOT, and also a Document Type (Invoice, Statement, etc) which is a Managed Metadata field, and both of these fields are updated on the form when I use the setFieldValue function to update them.
So, I am guessing that there is some subtle trick to getting a field which is controlled by spjs.lookup to update if the field changes behind the scenes as it were?
Regards
Jeff -
June 19, 2016 at 00:58 #12016
Sorry, this was supposed to be a new post, not attached to this one.
-
June 19, 2016 at 01:10 #12018
…and looking at this on another day, I manage to find the answer.
spjs.lookup.setValue(“FieldInternalName_of_your_field”,”The value you want to set”);
All sorted.
-
June 19, 2016 at 10:29 #12020
I’m glad you figured it out.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.