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, ...
Answered

Report result does not change after adding range to the data source from code

(0) ShareShare
ReportReport
Posted on by 15

Hi

I have added three tables as report data source (InventTable, InventTrans, InventDim)

then I added date field to the dialog

and I want to add this date filter to the current query

I have created this method

private Query buildPeriodQuery()
{
    QueryBuildDataSource    queryBuildDataSource;
    QueryBuildRange         queryBuildRange;
    Query                   queryBuild;
    ;
    queryBuild              = new Query(this.query().pack());
    queryBuildDataSource    = queryBuild.dataSourceTable(tablenum(InventTrans));
    queryBuildRange         = SysQuery::findOrCreateRange(queryBuildDataSource, fieldnum(InventTrans, DatePhysical));
    queryBuildRange.value(queryRange("", toDate));
    
    info(queryBuildDataSource.toString());
    
    return queryBuild;
}

Then I called it in getFromDialog

public boolean getFromDialog()
{

    ;
    
    toDate = dlgToDate.value();
    
    this.buildPeriodQuery();

    return true;
}

and this is the query result

SELECT FIRSTFAST * FROM InventTrans 
WHERE InventTable.ItemId = InventTrans.ItemId 
AND ((DatePhysical<={ts '2021-02-01 00:00:00.000'})) 
JOIN FIRSTFAST * FROM InventDim 
WHERE InventTrans.inventDimId = InventDim.inventDimId

But the date filter does not affect the report result

Thanks in advance.

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,075 Super User 2025 Season 2 on at

    Hi Khaled,

    Can you elaborate on the contents of this report? Is it a standard report which got customized or a new custom report from scratch? What details are to be shown on the report? Do you have more methods with x++ coding on this report?

  • Khaled_Fahim Profile Picture
    15 on at

    Hi André

    Thank you for your reply

    It is a new custom report from scratch.

    The report shows Item group, Number, Name, Dimensions from my three tables.

    and on-hand quantity and posted cost as a display methods in X++ for filtered transactions on a specific date selected by user

    When I select date from dialog query select button every thing works well. but when I use created date dialog field the data  does not change

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
Martin Dráb Profile Picture

Martin Dráb 551 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans