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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Applying extra filter to parent query and its effect on composite query

(0) ShareShare
ReportReport
Posted on by

in pay statement list page I try to apply extra filter to from query using Pay statement form data source and joining extra data source to apply the filter   using OnInitialized event handler , the extra added filter affect only the  all pay statement list page with no effect on other list pages like calculated and issued even that these menu items are linked with same form with a composite query determined at each  menu item , how can I make this filter affect composite queries ?

  • Sergei Minozhenko Profile Picture
    23,099 on at

    Hi maram fraij,

    You have mentioned OnInitialized event handler. Is it form an event handler or data source (which data source) event handler? Are you applying filtering based on conditions? Can you share your code?

  • maram fraij Profile Picture
    on at

    The code is applied using OnInitialized   data source event handler  ans using main data source pay statement  in my case .

    There is not condition , please find the code below :

    [FormDataSourceEventHandler(formDataSourceStr(PayrollPayStatement, PayrollPayStatement), FormDataSourceEventType::QueryExecuting)]

    public static void PayrollPayStatement_OnInitialized(FormDataSource sender, FormDataSourceEventArgs e)

       {

           FormDataSource              PayrollPayStatement_ds;

           QueryBuildDataSource     QBD1,QBD2;

           QueryBuildRange             QBR1;

           PayrollPayStatement_ds  = sender.formRun().dataSource("PayrollPayStatement");

           QBD1=PayrollPayStatement_DS.query().dataSourceName("PayrollPayStatement");

           QBD2=QBD1.addDataSource("MyTable");

           QBD2.name("MyTableFilter");

           QBD2.joinMode(JoinMode::InnerJoin);

           QBD2.relations(false);

           QBD2.addLink(fieldNum(PayrollPayStatement,Worker),fieldNum(MyTable,Worker));

           QBR1= QBD2.addRange(fieldNum(MyTable,Field1));  

           QBR1.value(FilterValue);

           QBR1.status(RangeStatus::Hidden);      

       }

    Field1 is string field , FilterValue is string value

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 415 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 374

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 365 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans