How to use dynamic columns in Export to Excel

      Hi,

     I am facing a development issue related to Export to Excel when the header has dynamic columns. For example, sometimes I have 5 buyers, sometimes I can have 10 buyers and so on. The number of buyers in my case isn't a value that can be calculated, it's a random one. In the Export to Excel sheet, each buyer has to be added on different columns.

   My main issue is that I don't know how it's achievable in OutyStems to build an excel in which the columns of the header aren't static ones and how I have to handle the structure behind the Excel in this case?

   Thank you!

Hi Mihaela,


In this case I suggest you to build your template using the component Excel Package (https://www.outsystems.com/forge/component-overview/1044/excel-package).


I hope to help you


Best regarsd,

Maycon Silva

Normally, the different entries in a list would be exported as lines and not columns while the different attributes of the line goes into columns:

The number of lines would then be variable and able to handle any number of records.

This you can easily do by creating an aggregate and a structure corresponding to the attributes you wish to export. Using a structure list variable you can then assign the attributes of the aggregate to the structure list variable. This article gives detailed instructions on how this is done.

If having a variable number of columns is a firm requirement, then export to excel will not work and you might want to have a look at the advanced excel forge component.

Mattias Rundberg wrote:

Normally, the different entries in a list would be exported as lines and not columns while the different attributes of the line goes into columns:

The number of lines would then be variable and able to handle any number of records.

This you can easily do by creating an aggregate and a structure corresponding to the attributes you wish to export. Using a structure list variable you can then assign the attributes of the aggregate to the structure list variable. This article gives detailed instructions on how this is done.

Thank you very much, Mattias, but besides buyers, I have a lot of requests on the lines and for these requests, I have the buyers.


Mihaela Vasiu wrote:

Mattias Rundberg wrote:

Normally, the different entries in a list would be exported as lines and not columns while the different attributes of the line goes into columns:

The number of lines would then be variable and able to handle any number of records.

This you can easily do by creating an aggregate and a structure corresponding to the attributes you wish to export. Using a structure list variable you can then assign the attributes of the aggregate to the structure list variable. This article gives detailed instructions on how this is done.

Thank you very much, Mattias, but besides buyers, I have a lot of data and on the lines, I have a much more requests( which contains the buyers).


Would it be possible to show an example of what output you are looking for as that isn't fully clear to me?

Mattias Rundberg here is an example: