FileUpload Widget - Verify data before Uploading
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
FileUpload Widget - Verify data before Uploading
Mashup contains - FileUploadWidget and a Grid Widget
When I select a csv file (currency.csv) then before uploading that csv I want to view that in the right side grid.
Datashape Contains- Code, Name, Symbol
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Mashup-Widget
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The Upload Widget only uploads the files. There is no preview before upload to TWX. I am not aware of such a widget from TWX-base functionality.
You most likely need to create a custom widget with your UseCase which reads file in local browser and set it to the Grid. Maybe someone else knows about such a widget. As workaround an idea, but not sure if applicable: Maybe the user can paste the csv content into a textarea and you work with that? The text you could parse to the grid and if user confirms create a file in fileRepo on your own.
Regarding your bindings (with first upload to repo):
- You should only call "LoadCSV" service on "UploadComplete" event of the upload widget (not on Mashup Load event).
- as 'path' you should bind "FullPaths" property of the upload widget (will only work if you upload a single file (otherwise the property will have path1|path2|path3 - separated by |)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The Upload Widget only uploads the files. There is no preview before upload to TWX. I am not aware of such a widget from TWX-base functionality.
You most likely need to create a custom widget with your UseCase which reads file in local browser and set it to the Grid. Maybe someone else knows about such a widget. As workaround an idea, but not sure if applicable: Maybe the user can paste the csv content into a textarea and you work with that? The text you could parse to the grid and if user confirms create a file in fileRepo on your own.
Regarding your bindings (with first upload to repo):
- You should only call "LoadCSV" service on "UploadComplete" event of the upload widget (not on Mashup Load event).
- as 'path' you should bind "FullPaths" property of the upload widget (will only work if you upload a single file (otherwise the property will have path1|path2|path3 - separated by |)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@nmutter Can you please look at the solution of the below link
Solved: CSV Parser - PTC Community
I wanted to know the bindings that is been done here.
@eliotlandrum I am not able to bind the data properly. Can you please help in this regard?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
We want to preview the csv data before inserting the data into the data table.
Steps :
1.. Pre-requisite -> CSV Parser Extension Imported (You can get if from - https://iqnox.com/thingworx-widget-development/ )
2. Firstly you should know your data - Make data shape accordingly.
3. Make a data table
4. Write a service, suppose service name - "LoadCSV" to load the data.
a. Snippets -> Resources -> ReadCSVFile to get Javascript snippet. Make the changes accordingly shown in the screenshot.
b. Make another service to get data entries
Me/Entities -> services -> GetDataTableEntries
5. In Mashup -
FileUpload Widget,
Grid1 (for preview),
Button (if we click, data should be added to data table and to Display the data into the grid)
Grid2 (to display the data table content)
6. Bindings
a. File Upload Widget
2. Preview
3. Button
(Note: Doble click the button - First the data is been added to the data table then we can get the data elements in the grid)
4. Uploaded to Data Table Grid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Although you marked this as a solution, to be clear, this is not what you asked for. You are now uploading the data to Thingworx to show it in a grid.
Your request was to view the data in the grid "before uploading that csv".
With respect to your question, @nmutter's reply would the the correct answer.
