Do you any of you guys know how to add a button in an interface with the function of converting a query or a record type to an excel and downloading the converted excel in a push of that button without needing a grid and its built in export function?
Discussion posts and replies are publicly visible
I dont think thats possible. That is a built in functionality which appears when using record as the source in a grid. You have to build the functionality manually.
You could create a Web API which creates that Excel file. Then use a link to point to this API. With a correct setup of HTTP headers in the API, the browser will just download the file.
Hi
To implement a button in an Appian interface that allows users to convert query results or a record type data into an Excel file and then download it with a single click, without using a grid's built-in export functionality, you can indeed follow Stefan Helzle's approach using a Web API.
Web API expample:
/* Web API Endpoint: 'generateExcel' Method: GET*/
/* Query your data */ local!data: queryEntity(
entity: cons!MY_RECORD_TYPE, query: a!query())
/* Generate Excel */ local!excelFile: createExcelFile(data: local!data)
/* Set up response to download file */ response( headers: { 'Content-Disposition': 'attachment; filename="data.xlsx"', 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }, body: local!excelFile )
a!buttonWidget( label: "Download Excel",)
Is that an answer from ChatGPT? While most things in that code are plausible, it is not a valid expression.
E.g. the button component has no link parameter.
Next time, please either validate what you got from ChatGPT, or clearly point out from where you got it.
Thank you for recognizing the plausibility of the concepts presented in the code example(Edited). The intent was indeed to illustrate the underlying approach rather than to provide a plug-and-play solution, which may have led to some oversight in the specificity and execution details in the example provided.