cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Collecting data from the user and writing to an excel file

Contributor

Collecting data from the user and writing to an excel file

Was wondering what would it take to record a user's input then output it to a new and/or existing excel file. Do I need to have Thingworx Composer for this?

2 REPLIES 2

Re: Collecting data from the user and writing to an excel file

Hi @WesN ,

in  the different studio widget  events you can collect the required data and save it to a session variable e.g. in Json format.

Then you can send this data to Thingworx via SaveBinary  ( related info in e.g. post Attach / Associate files with a thing  or How to capture a screenshot? )  

Call something like:

 

 

//////////////////////////////////////////////////////////////
$scope.SaveBinJsonToTwxRepository = function(path, content) {
 $scope.$applyAsync(function() {
     $rootScope.$broadcast('app.mdl.CAD-Files-Repository.svc.SaveBinary',
    
                           {"content": JSON.stringify(content), "path":path}

                         );}   ,500 );

};
//////////////////////////////////////////////////////////////

 

 

 

 Where we can send a json file to repository.

Otherwise you can use some approach as described in the dev.mozila article "Sending and Receiving Binary Data"

In this case you need to have a server which will understand your request - means need to save the data - I think this could be easily done by javascript with node.js - there are a lot of example in Web.

The only problem you will have is the CORS restriction - so means your server should have the same main domain as yourExperience service

 

One additional point you mentioned excel - so the normal way is using some csv - I think this will be also better to be solved in Thingworx using the CSVParser extension. Otherwise you need to use some script to convert the json to csv. Also it could be possible that you can use same Excel macros to read the json file - I used in the past such macros  but I  have no Idea if this is provided by the default Excel  installation. 

Highlighted

Re: Collecting data from the user and writing to an excel file

This seems like a reasonable solution. I am not able to test nor implement at the moment, as I currently do not have authorization to access to my company's backend database. Will provide an update if/when I do get access.

 

Thanks!

Announcements
Topics available:
AR/VR for Data Optimization AR/VR for Security and Control AR/VR for Inspection