Sharepoint column field type changing from original Infopath form field type - sharepoint-2013

I have an Infopath form I promoted an element with an integer type to the SharePoint library where the saved forms are stored. I am finding that SharePoint is treating this field as a line of text instead of as number which I need as I would like to be able to use key filtering to help people look through the library. Any idea how to fix this?

Unpromote and reprobate InfoPath element after ensuring correct element type.

Related

Mapping user spreadsheet columns to database fields

I’m not sure where to start on this project. I know how to read the contents of the excel spreadsheet, I know how to identify the header row, I know how to loop over the contents. I believe I have the UX portion worked out but I am not sure how to process the data.
I’ve googled and only found .Net solutions but I’m looking for a ColdFusion/Lucee solution.
I have a working form allowing me to map a user's spreasheet column to my database values (this is being kept simple for this post; user does not have direct access to the database).
Now that I have my data, I'm not sure how to loop over the data results. I believe there will be several loops (an outer and an inner). Then of course I also need to loop over the file contents but I think if I can get the headings mapped out,I can figure out the remaining.
Any good links, tutorials, or guides would be greatly appreciated.
Some pseudo code might be enough to get me started.
User uploads form
System reads headers and content.
User is presented form with a list of columns from their uploaded spreadsheet to match with available database fields (eg “column1” matches “customer name”.
User submits form.
Now what?
UPDATED
Here is what the data looks like AFTER the mapping has been done in my form. The column deliiter is the ::: and within the column the ||| indicates the ID associated with the selected column value. I've included the id and the column value since I plan on displaying the mapping again as a confirmation. Having the ID saves a trip to the database.
If I understand correctly, your question is: how do you provide the user a form allowing them to map their spreadsheet columns to that of the database
Since you have their spreadsheet column names, and you have the database column names, then this problem is essentially a UI/UX problem. You need to show both lists, and allow the user to map them. I can imagine several approaches to this. My first thought would be some sort of drag/drop operation, as follows:
Create a list of boxes, one for each field in your database table, and include the field name in (or above) the box. I'll call this the db field list. Then, create another list for each column from the spreadsheet, which I'll call the spreadsheet column list. The user would drag/drop items from the spreadsheet column list to the db field list.
When a mapping has been completed by the user, you would store the column/field names in as data for the DOM element of the db field list box. Then upon submission, you would acquire the mapping data by visiting each box and adding it to an array. Then you would serialize that array into JSON and send that to your form submission handler.
This could be difficult or easy, depending on your knowledge of UI implementations using JavaScript. jQuery makes this easy (if you know jQuery). There's even a jquery UI plugin that does this: https://jqueryui.com/droppable/.
A quick search for javascript drag drop would help, and here's a few articles I found:
https://www.w3schools.com/html/html5_draganddrop.asp
https://medium.com/quick-code/simple-javascript-drag-drop-d044d8c5bed5
You would also need to submit the array of mappings using javascript. You could search for that as well, and here's an article I found:
https://codereview.stackexchange.com/questions/94493/submit-an-array-as-an-html-form-value-using-javascript

infopath form vlookup function based on sharepoint list BUT based on texboxes only (no dropdown)

I am fairly new to InfoPath and trying to create a form now that will link to the SharePoint list. Where I am stuck is that a lot of the steps online show you how to vlookup two fields (where one is a dropdown and another text box)But I need 2 fields to be a textbox field and connect them based on the sharepoint...so one text box field will automatically fill out info based on another Text box field..
So I have 2 infoPath fields:
a)Consumable Part number -> as a textbox - here user can manually enter the partnumber (I cant use dropdown here because we have circa 600 entries here!). All entries are stored in the sharepoint list in the Consumable Part Number column
b)Consumable Description -> as a textbox - here the field fills in automatically as soon as user enters the correct partnumber that indeed is available on this sharepoint list and each partnumber is linked to its unique Consumable Description. All entries are stored in the sharepoint list in the Consumable Part Number column
Is there anyway I could work around this please?
Thanks so much!
Add a data connection to the SharePoint List. Set the data connection to not run on form open - that is a checkbox in the last dialog box when you create the data connection.
On the text box where the user can enter a part number, add the following rules.
Rule condition - field bound to the text box for the user entered part number is not blank
Set a field's value - select the Part Number Query field from your SharePoint List data connection (be sure you pick the part number field in the "queryFields" folder)
Query for data - run the query to your SharePoint list
Set a field's value - set the field you want to have the description in to the returned data field Consumable Description in your SharePoint list data connection
Since you are querying based on the user entered part number, you should get back 0 or 1 item(s). You can add other rules to handle for the user entered number not being found (count of items returned in the SharePoint List data connection equals 0, you could display an error on the form, for example)
Edited to elaborate in light of additional comments:
The above technique sets a query field and returns items that match only that query field. If you have additional fields that dictate which list data should be returned, you'd set additional query fields.
If, instead, you need all items returned from the list and then you need to use XPath filters to determine which item you need from the list, you'd use the filter data button when picking the field that has the value you wish to use in your set value rule - from there you can add the various filters you need.
I'm afraid that I don't understand what you are attempting to achieve based on your comments.

Sitecore adding field labels to name value list

I am trying to display field titles above the appropriate columns in a name value list in Sitecore.
e.g. So instead of this
The name value list would look like this
Is there an easy method of achieving this apart from writing a custom control?
There is no out of the box support for applying a label to the values in a name value list, as #jammykam mentioned.
Since what you are storing would not typically be handled as key/value data, the name value list type might not be the best fit for what you are doing - think what you would have to do if you needed to add extra information e.g. title. I would suggest creating a simple template for 'person details' and then add 'people' items as sub-items of your existing item.
Seems like you want to give the authors a hint regarding the input fields and the best way to do that is using the "Short Description" field in "Help" section of the template under Standard Values. You can possibly enter something like as a hint.
A less optimal option would be to set up standard values for that field so the authors always have a value that suggests the type of input value for key and value.

Set default value for a field in share point 2010 list

I have a lookup field in list in share point 2010, how to set a default value for that field at inserting operation
Using JavaScript, override the PreSaveAction method and push whatever you like into the lookup column. this happens just prior to the post to the web server, so you cna do all validation and checks.
Beware though, the value you insert must exist in the lookup list or the post will fail, ie don't push a value of "abc" if "abc" is not on the list of possible options fo rhte lookup column.
If you want to preselect some value in lookup control (dropdown) when dialog is open you need to do it by JS. You need to hook onload (JS) event of the page. There are some libraries that makes it easier to set SharePoint field values e.g. SPJS-utility. Common way is that you send id of item using URL parameter and get by JS and then set it to field. Speaking of lookup beware of the fact that SP renders lookup control in different way in IE for less than 20 items and for more than 20 item.

How to update (not overwrite) a multiple choice lookup field using updatelistitems

I have a list in sharepoint foundation. Each item has a field which is of type lookup. A user can select multiple values in this field.
Some items already have values selected in this field. I would like to update a number of items using the updatelistitems call in the Lists web service. Whenever I update an item though, the new value overwrites the existing value in this field instead of appending to it.
Is there a way to append the new value?
Thanks
You need to first retrieve the selected values of these fields and hold in a collection and then merge with your new values and update back to the field...