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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Can we make print button widget to download in particular folder.

AP_10343008
13-Aquamarine

Can we make print button widget to download in particular folder.

Can we make print button to download in particular folder instead of downloading in downloads folder?

7 REPLIES 7

Hi @AP_10343008 

 

You can change download folder option in browser 

Velkumar_0-1723526759274.png

 

I don't think you can control it in widget level.

 

/VR

 

AP_10343008
13-Aquamarine
(To:Velkumar)

That is common for every operation. 
I want to store file in repository when user clicked thingworx button widget, Apart from this activity, user can decide folder location for other browser related downloads. I want both to be two different locations independently.

 

 

 

TonyZhang
13-Aquamarine
(To:AP_10343008)

Hi @AP_10343008 ,

If you want to save file to thingworx repository, you need to let users input "repository name", "path" and "file name" in Mashup, and under the hood trigger a custom service that executes functions like below that takes the user input to save file to specified destination.

 

Things["<RepositoryName>"].SaveBinary({
  path: undefined /* STRING */,
  content: undefined /* BLOB */
});

 

If you want users to download to local PC and specify target folder, users need to change the settings in browser as mentioned by Velkumar

AP_10343008
13-Aquamarine
(To:TonyZhang)

What file type this api creates in the location?
I want to create excel file with exported data or pdf file in the provided path.

TonyZhang
13-Aquamarine
(To:AP_10343008)

"path" parameter of this API is where you specify the path, the file name, and the file extension.

So which file type to create depends on how you specify the "path". (it can create any type as long as the file content is passed correctly)

See below example:

 

Things["<RepositoryName>"].SaveBinary({
  path: "/test.xlsx" /* STRING */,
  content: undefined /* BLOB */
});

Things["<RepositoryName>"].SaveBinary({
  path: "/test.pdf" /* STRING */,
  content: undefined /* BLOB */
});

 

 

AP_10343008
13-Aquamarine
(To:TonyZhang)

This API accept only binary input. But i have infotable data to generate in excel. Do I need to convert infotable data to binary? If yes, how it can be done ?

TonyZhang
13-Aquamarine
(To:AP_10343008)

I don't think infotable data can be converted to binary.

SaveBinary service is to be used when you already have an Excel file out there and  want to "download" it to your ThingWorx file repository.

Check out this article if you want to create an Excel file from ThingWorx using infotable data.

If needed, convert csv to Excel after without using TWX.

 

Announcements

Top Tags