converting to excel and downloading a record type with one click of a button

Certified Associate Developer

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

Parents
  • 0
    Certified Associate Developer

    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
        )

    Interface Button Configuration

    a!buttonWidget(
    label: "Download Excel",

    )

  • 0
    Certified Lead Developer
    in reply to VAS

    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.

  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    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.

Reply Children
No Data