Dynamic header for excel/text file.

Hi Experts,

I Would like to ask, how can I make my header dynamic whether I use download excel or a text file.

Champion

Hi Ja,


Can you detailed more on dynamic header ?

Usually I use advance excel plugin (https://www.outsystems.com/forge/component-overview/355/advanced-excel) for generating excel (so I can put any header that I want)


Thanks

Hello Ja,

Can you please elaborate more.

Are you talking about inserting a heading in file?


Thanks,

Krunal

Hello Ja 

What I have understood is you want one control so when you download the data in Excel or TXT you can decide the Header (The First Top Row) Data. You want to add the 1st row as you want it. 


If I am correct, you can do this. when you assign the data to binary data while downloading please add your header content there as first row. 


Attached is one sample to download the data in TXT File. You can use the same and define your first row here 1 time before the loop begin 


Please feel free to ask me if you have any further question.

DownloadEntityDatav1.oml

Hi Experts,

Thanks for your prompt response.

Please see attached sample screenshot.

The header will be dynamic and will be based on the date and the total number.


You can achieve this from the solution I have shared. Let us know if you need more clarification

Hi Manish,

Good day.

I have tried to use your solution, however, I'm having a problem with how can I execute the dynamic header.

Can you help with how can I execute it?

Can you tell me the logic of Date and Total Number there - 

  1. Is it today's date and total number of records of today?
  2. Did you select on Date in Web and add that as header with total records that day?


I hope my question is clear to you with above two scenario. I want to understand about the logic of data and count.


Thanks

The date is dynamic also, meaning the date will be based be on the table rows, not the date today specific.

the total number will be counted as the total sum.

So, let's say if table has 10 rows where 5 rows are of 25-05-2021 and 5 rows of 24-05-2021


Now you are exporting that data. How would you like to get the data? Something like this as below with different headers in single file???


Header Row 25-05-2021 || 5 

Data Row 1

Data Row 2

Data Row 3

Data Row 4

Data Row 5


Header Row 24-05-2021 || 5

Data Row 1

Data Row 2

Data Row 3

Data Row 4

Data Row 5

Yes, but instead of 5 it will be 15. is it possible or do I need to use an extension for this?

5 was Just the example numbers. You can do with any numbers. No issues. 

Here in my opinion you will need to use the 2 Aggregates. 

1) Let's create the copy of data aggregate and Groupby Date and Add count() attribute - For Date and Count

2) The Existing Aggregate for the Data


Create one Sort in both (Datewise) to keep accuracy in data setting. 


Then in the DATA when you are assigning the value to print - 

  1. Take Date and Count from New Aggregate 
  2. Then take data from 2nd aggregate where Data = Date taken from new one
  3. Make it in loop
  4. Download the file. 


Hope it is clear, thanks

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.