ERROR while exporting grid data to excel

I have the below expression rule, and which is pointing to an entity using a constant.

a!queryEntity(
  entity: cons!AT_EMPLOYEE2,
  query: a!query(
    logicalExpression: a!queryLogicalExpression(
      operator: "AND",
      filters: {
        a!queryFilter(
          field: "status",
          operator: "=",
          value: ri!status
        )
      },
      ignoreFiltersWithEmptyValues: true
    ),
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: 10,
      sort: a!sortInfo(
        field: "employeeId",
        ascending: false
      )
    )
  ),
  fetchTotalCount: false
).data

and I have the below code, and which is containing a grid and the data getting loaded based on the "Status" dropdown selection.

I am getting an error while exporting the data into an excel. Can someone advise what needs to be done.

The error is at the line " entity: 'type!{urn:com:appian:types:AT}AT_employee2(rule!AT_getEmployeeDetailsByParameters(status: local!status)',"

a!localVariables(
  local!status,
  local!exportDocId,
  local!errorMessage,
  
{
  a!boxLayout(
    label: "Box",
    contents: {
      a!dropdownField(
        label: "Status",
        placeholder: "-- Select a Status --",
        choiceLabels: {
          "New",
          "Updated",
          "Open"
        },
        choiceValues: {
          "N",
          "U",
          "O"
        },
        value: local!status,
        saveInto: local!status
      )
    },
    style: "STANDARD",
    marginBelow: "STANDARD"
  ),
  if(
    isnull(local!exportDocId),
    /*This link field contains the link that starts the export*/
    a!linkField(
      labelPosition: "COLLAPSED",
      links: a!dynamicLink(
        label: "Export to Excel File",
        saveInto: {
          a!exportDataStoreEntityToExcel(
            entity: 'type!{urn:com:appian:types:AT}AT_employee2(rule!AT_getEmployeeDetailsByParameters(status: local!status)',
            documentName: "Excel Export " & now(),
            saveInFolder: cons!AT_DOCUMENTSFOLDER,
            onSuccess: a!save(local!exportDocId, fv!newDocument),
            /*This displays an error if there is an issue executing the the save*/
            onError: a!save(
              local!errorMessage,
              "Error Exporting File to Excel"
            )
          )
        }
      )
    ),
    {}
  ),
  if(
    /*This only displays the download link if a valid document was created*/
    not(isnull(local!exportDocId)),
    /*This changes the link to a download link for the newly created document */
    a!linkField(
      links: a!documentDownloadLink(
        label: "Download Excel File",
        document: local!exportDocId
      )
    ),
    a!textField(value: local!errorMessage, readOnly: true)
  ),
  a!gridField(
    label: "Read-only Grid",
    labelPosition: "ABOVE",
    data: rule!AT_getEmployeeDetailsByParameters(status: local!status),
    columns: {
      a!gridColumn(
        label: "Status",
        sortField: "status",
        value: fv!row.status
      ),
      a!gridColumn(
        label: "Dateadded",
        sortField: "dateadded",
        value: fv!row.dateadded
      ),
      a!gridColumn(
        label: "Added By",
        sortField: "addedBy",
        value: fv!row.addedBy
      ),
      a!gridColumn(
        label: "Coverletter",
        sortField: "coverletter",
        value: fv!row.coverletter
      ),
      a!gridColumn(
        label: "Gender",
        sortField: "gender",
        value: fv!row.gender
      ),
      a!gridColumn(
        label: "Mothertongue",
        sortField: "mothertongue",
        value: fv!row.mothertongue
      ),
      a!gridColumn(
        label: "Date Of Birth",
        sortField: "dateOfBirth",
        value: fv!row.dateOfBirth
      ),
      a!gridColumn(
        label: "Age",
        sortField: "age",
        value: fv!row.age
      ),
      a!gridColumn(
        label: "Lastname",
        sortField: "lastname",
        value: fv!row.lastname
      ),
      a!gridColumn(
        label: "Firstname",
        sortField: "firstname",
        value: fv!row.firstname
      ),
      a!gridColumn(
        label: "Employee Id",
        sortField: "employeeId",
        value: fv!row.employeeId
      )
    },
    validations: {}
  ),
  
  
}
)

  Discussion posts and replies are publicly visible

Parents Reply
  • Hi,

    I am getting all the columns from a table based on the "Status" column filter using Expression Rule and showing in the grid. It is perfectly already and no issues.

    When I try to export the data to excel using "exportDataStoreEntityToExcel" service is it expecting an entity.

    But, I can provide a constant which can refer the entire table.

    I want only certain data based on the filter which I will pass. In this case it is a "Status" column.

    Thanks

Children