Export to Excel Order the columns

Export to Excel Order the columns

  
Hi,

I would like to export the data into excel with some order and specific columns in the custom order list.

Details of Current Issue:-
If I used three tables in the dataset, all the fields (or whatever I selected/checked in RecordListToExcel properties) exporting as it is.

Table1.Field1 (Identity column)
Table1.Field2 (FK column integer - Table2.Field1)
Table1.Field3 (boolean column)
Table1.Field4 (Date column)
Table1.Field5 (FK column integer - Table3.Field1)

Table2.Field1 (identity column)
Table2.Field2 (text column - Name)

Table3.Field1 (identity column)
Table3.Field2 (text column - Name)


Expecting output:

Table1.Field1
Table2.Field2
Table1.Field3
Table1.Field4
Table3.Field2

Can you please let me know how to do  that?

Thanks,
Sam





Hi Sam,

If I recall correctly, the Export to Excel exports the data in the same order and shape that it is in the list. As such, either you have a query return the data as you want it to be exported, OR you can generate a list in the export action with the data you want, by the order you want it.

You can do this by:

1 - Creating a structure with the proper attributes that will be exported
2 - Creating a local variable in the export action of type record list and your new structure as its record definition
3 - Use the ListAppend action to append new items to the list

I hope this helps, or at least that it gives you some ideas on how to achieve what you're trying to get to.

Regards,

Paulo Tavares
What would be great was if on the Outsystems studio, instead of a "check" to select the fields, it would offer an order ID for the column. Or even better... allow some kind of drag&drop reorder on the field list, not only here, but on other places where lists with lots of fields can get messy after a few development iteration cycles.