Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Can we make print button to download in particular folder instead of downloading in downloads folder?
Solved! Go to Solution.
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
Hi @AP_10343008
You can change download folder option in browser
I don't think you can control it in widget level.
/VR
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.
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
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.
"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 */
});
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 ?
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.
Hi @AP_10343008,
It appears that a response to this post answered your question. For the benefit of other Community Members who may have the same question, it would be great if you could designate an appropriate response as the Accepted Solution.
In the event that this response did not answer your question, please post your current status so that we can continue to support.
Thanks for using the PTC Community!
Regards,