Skip to main content
May 11, 2023
Question

Export Read Only grid with variable source to Excel

  • May 11, 2023
  • 9 replies
  • 0 views

Hi everyone, 

I need to export the data contained in a Read Only grid with variable Data Source, therefore I cannot use the default Export functionality available for Record and entity based grids.

My grid can have two sources of data, one being the default columns I have on the report on which it is based and/or one or more columns that users can select with a UI we made.

The grid then can have a mix of Report and Database data source.

I tried the exportProcessReportToExcel function, but it only works with the data and columns set on the report.

I'm looking for a way to export to Excel the whole content of the grid, whether it is an OTB function or a plugin.

Thank you very much in advance. 

9 replies

mikes0011
Brainy
May 11, 2023

You might have some luck using the Export CDT to Excel smart service available in the Excel Tools plug-in, which while marked as Deprecated, still works in all recent versions that I'm aware of.  You would call it from a process model (which you can call from your form), cast your data set (passed into the process however you like, like in a Map array) into a custom CDT you create (i suggest just creating a generic all-text CDT with columns named like "col1", "col2", etc), then passing that into the smart service.  If you do these setup steps correctly then it shouldn't be too much of a lift overall.

May 11, 2023

Thanks Mike, 

A follow up question for this.

The grid I have is a "a!gridField", as explained before uses a mix of the default Task Report columns, for example:

TaskName |  |Object ID | TaskCreationDate | AssignedTo | Status

But if a user selects a different value on a dropdown I will add as much as N columns to the grid, which come from Database a table, these columns and values are added to it and related by the ID on the report, then the grid will look something like this:

TaskName | Object ID | TaskCreationDate | AssignedTo | Status | ObjectDetail A | ObjectDetail B | ... |ObjectDetail N

Then given this, do you have any suggestions to export or extract the data from the gridField?

As shown below, the gridField uses the Report Data plus anything that may be added and an extra column for a record action.

I tried creating an expression to create it and then access the properties from there, but I did not have much luck.

Thanks for the advice.

mikes0011
Brainy
May 12, 2023

The only suggestion I can offer is to try assembling the grid data before rendering the grid, instead of *while* rendering the grid - in other words, take whatever logic you're using to create the data row-by-row, and move it to a local variable (which you can then reference by your grid as well as passing into a process to handle document generation).

mathieud0001
May 12, 2023

I built one using https://docs.appian.com/suite/help/23.1/Export_Process_Report_Excel_Smart_Service.html. I used a dummy (empty) process report and used the Custom Cell Positions and Custom Cell Values to manually push to some values to it.

ulisese2579
May 15, 2023

Hi Mathieu,

Do you have an example on how to use these properties? the documentation only says:

Custom Cell Positions Text Array of cell positions where custom cell values should be added.
Custom Cell Values Text Array of values to be added on the specified custom cell position

Thanks

mikes0011
Brainy
May 15, 2023

Positions: {"A1", "B2", (etc)},

Values: {"Value for cell A1", "Value for cell B2", (etc)},

They can be literally anything you want, as long as the positions array is a valid list of cell identifiers like above, and as long as the values array is a valid list of string that matches the length of the "positions" array.

konduruc733182
May 13, 2023

Hey arturot5758

I can think of one way to achieve this. You can write a stored procedure and create a sql statement using the variables that you select on the UI. You can later cast this data into the cdt that you wish and export it into excel.