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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

ExportInfotableAsExcel

BryanK
16-Pearl

ExportInfotableAsExcel

Hi All,

I looked around for some sort of examples for using the ExportInfotableAsExcel but could not find anything.

The Documentation is not great so i thought i would share how I got mine working. If I have missed anything please let me know.

When Importing you get an error message from TWX that says something about Jar Conflict.

JAR conflict Checking ThingWorx system JARS [existing: bcprov-jdk15on-1.51.jar, package: bcprov-jdk14-1.38.jar]

You need to delete the offending jar in the extension and update the xml file. and then you can import it.

 

If you then use it like that and create a thing based on the DataExporter it works well.

Create a service and use the following code.

 

var params = {
	oldestFirst: undefined /* BOOLEAN */,
	maxItems: 500 /* NUMBER */,
	endDate: undefined /* DATETIME */,
	query: undefined /* QUERY */,
	startDate: undefined /* DATETIME */
};

// result: INFOTABLE dataShape: "undefined"
var result1 = me.QueryPropertyHistory(params);

var params = {
    infotable: result1
};
var result = me.ExportInfotableAsExcel(params);

But the issue that I had was I already had an existing thing that I wanted to export data for.

I thought that I could just use service from the DataExporter, but for some reason they are not there? (am i doing something wrong?)

Capture.PNG

As a last resort i created an additional thing to see if I could pull the services from that one.

and I could.

Capture1.PNG

So now my code looks like this.

var params = {
	oldestFirst: undefined /* BOOLEAN */,
	maxItems: 10 /* NUMBER */,
	endDate: undefined /* DATETIME */,
	query: undefined /* QUERY */,
	startDate: undefined /* DATETIME */
};

// result: INFOTABLE dataShape: "undefined"
var result1 = me.QueryPropertyHistory(params);
//
var params = {
    infotable: result1
};

    

// result: STRING
var result = Things["Data_export_test"].ExportInfotableAsExcel(params);

Its a simple example but it now works.

if you see where i went wrong please direct me to the correct solution.

Thanks

Bryan

 

0 REPLIES 0
Announcements


Top Tags