I have a scenario where in the business wants to import a CSV file contents to a repeater control, i.e. when using Nintex forms they would add some details on the rest of the form and want to populate a repeater control with contents from a csv fil e(as they are in excess of 20) so they dont want to be manually typing them! and once imported they then submit the form.
I understand its a bit easier if I had Nintex workflows to do import CSV into a list, but in this case its Nintex forms that needs to have this feature. The attachment control in Nintex also does not have a JS variable value which could be probed further
Has anyone else have any ideas around this? This seems to be a handy feature when you want to bulk insert into a repeater control.
There isn't a direct way to use Forms that I know, but a workflow could help by creating list items from the csv file uploaded to a document library. Once the items are created you can send a link to the items or to the list for the user so they could finish adding the required information. You can improve the user experience by having the link prefilter the items based on the creator, which is added by the workflow running on the doc library.
For an example of this, see an older blog post Nintex Workflow - Parse CSV and Create a List - Vadim Tabakman
Thanks very much for the reply, its not exactly what the business would want to do. As in this particular case the csv file would be different for any new items added, so we cant upload all the data in advance before the user tries to save the new item in the list and the data needs to be saved as part of the list item.
Ideal User experience would be that the user should be able to upload the data on the form (when he is on the form as part of his data entry) so all the rows are shown on the repeater control and then the user can validate the data (delete/edit etc) before saving the list item.
I tried to see in the client DOM when we select any document to attach just to see if we can somehow try to grab the attachment locally through client side and add it dynamically to the repeater control through JS, but sadly it looks like only the name of the attachment is available in the DOM and not the complete path.
I somehow think this should be a feature of Nintex Repeater control to be able to bulk upload items, it just helps in users not needing to add all those rows manually especially if there are in more in number!.
I see. There can be added a JS control to the repeating section, but all the data would need to be connected to a Multi Line Text field so you can parse it out later. That would require heavy customizations though.
Could you have one control in the Repeater that the user copies a single line into, hits plus to add a new row, copies the second line, etc. You can then parse in a workflow as well. Still not ideal for the UX though.
Thanks very much for the reply, it wont be ideal though .. as the user just would want to bulk import a csv into a repeater control to avoid typing all the individual rows into the repeater. I pretty much thought that there wont be any simplistic way of achieving this in Nintex, could have been more useful if Nintex would have provided a JS variable for the attachment control so the limitations from Nintex perspective could be overridden by some custom JS.
Looking briefly, I found these two:
Both libraries seem to be able to parse the file. The first library seems to have a little playground developed for it which should allow you to play around in your developer console to get a handle on how to use it (SheetJS Live Demo), while the second library (exceljs) gives an example of how to import csv files (with special options and other junk if needed) Exceljs: How To Read CSV Files.
Because I have never used either one of those libraries, I cannot vouch for their effectiveness or ability to get the information you're looking for, but ultimately I believe that they should at least allow you to be able to pull data directly from the file so that you can then use it in real time to build out a Repeating section if you so choose.
Hope this helps!
Thanks very much, I will go through both of them, it is very helpful though. Initially I was thinking of using the file attachment control from Nintex, and that did not give a handle to the document that was attached,( to be basically read into the repeater), but now with both of your approaches I might see if I can mimic a file upload routine or may be a file path to the csv as an input parameter and see if this library can be used to extract the contents and populate into the repeater (which I think is the easier bit!)
Thanks again your solution is very useful, will have a go at it to see if it does serve purpose.