web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

adding columns dynamically to the excel template

(0) ShareShare
ReportReport
Posted on by 942

Hello everyone,

I'm trying to develop a report based on the excel template. I use standard class XMLExcelReport_RU. I need to do one unusual thing I didn't before. I have created a temporary table with the info I'll need in my report. It contains records with the date field. Some records will contain the same value for the date field. I need somehow add columns with unique dates from the temporary table.

this is the code where I fill up my temporary table:

protected void createReport()
{
    int i = 1;
    this.initSectionMap();

    this.execute(#HEADER);
    
    while(qr.next())
    {
        smmActivityParentLinkTable = qr.get(tableNum(SMMActivityParentLinkTable));
        smmActivities              = qr.get(tableNum(smmActivities));
        tsTimeSheetLine            = qr.get(tableNum(tsTimeSheetLine));
        tsTimesheetLineWeek        = qr.get(tableNum(tsTimesheetLineWeek));
        
        
        for (i=1; i<=7; i =1)
        {
            if(tsTimesheetLineWeek.Hours[i])
            {
                taskDaysFactTmp_ICL.ActivityType        = smmActivities.ICLPRJDevTaskActivityType;
                taskDaysFactTmp_ICL.ResponsibleWorker   = HcmWorker::worker2Name(smmActivities.ResponsibleWorker);
                taskDaysFactTmp_ICL.ActivityDate = tsTimesheetLineWeek.DayFrom   (i-1);    
                taskDaysFactTmp_ICL.Hours = tsTimesheetLineWeek.Hours[i]; 
            }
        }
        
        taskDaysFactTmp_ICL.insert();
    }
        
    this.execute(#PageHeader);
    this.execute(#Body);
}

#PageHeader section in my template  will contain dynamic columns with unique dates from temporary table.

To do this I need to go through all records from my temporary table and somehow add columns to template:

protected void fillPageHeader()
{
    while select activitydate from taskDaysFactTmp_ICL
        group by taskDaysFactTmp_ICL.ActivityDate
        order by taskDaysFactTmp_ICL.ActivityDate
    {
        
    }
}

How to add columns to template with unique date fields from temporary table?

Thank you.

I have the same question (0)
  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi,

    I wonder if Excel is the right tool for this kind of report.

    To me it looks as if a power bi based report / cube would be better suited for this purpose.

    Have you checked out the standard cubes for AX2012?

    Best regards,

    Ludwig

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 456 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans