ThingWorx Navigate is now Windchill Navigate Learn More

Translate the entire conversation x

FileUpload Widget - Verify data before Uploading

Abhishek_Tirkey
14-Alexandrite

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

 

Abhishek_Tirkey_2-1737459785586.png

Abhishek_Tirkey_3-1737459824723.png

Abhishek_Tirkey_4-1737460324170.png

 

 

Abhishek Tirkey
ACCEPTED SOLUTION

Accepted Solutions

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 |)

nmutter_0-1737481435715.png

 

View solution in original post

5 REPLIES 5

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 |)

nmutter_0-1737481435715.png

 

Abhishek_Tirkey
14-Alexandrite
(To:nmutter)

@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?

 

Abhishek Tirkey
Abhishek_Tirkey
14-Alexandrite
(To:nmutter)

Thank you for the reply @nmutter 

Abhishek Tirkey

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.

Abhishek_Tirkey_0-1737531181661.png

b. Make another service to get data entries

Me/Entities -> services -> GetDataTableEntries 

 

Abhishek_Tirkey_1-1737531319858.png


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)

Abhishek_Tirkey_2-1737531492719.png

6. Bindings 
a. File Upload Widget

Abhishek_Tirkey_3-1737533953182.png

 2. Preview

Abhishek_Tirkey_4-1737533976948.png

 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)

Abhishek_Tirkey_5-1737534012467.png

4. Uploaded to Data Table Grid

Abhishek_Tirkey_6-1737534085301.png

 

 

 

Abhishek Tirkey

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.

Announcements


Top Tags