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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Answered

ExecuteQuery Method

(0) ShareShare
ReportReport
Posted on by 932

Hi,

I have form that contains 4 datasources like this:

1.UserInfo.

2.SecurityUserRole that has relation with UserInfo:linkType=delayed.

3.SecurityRole that has relation with securityUserRole : LinkType=InnerJoin.

4.EukMatrixRole that has relation with securityRole:linkType=Delayed.

I add executeQuery in SecurityUserRole :

public void executeQuery()
{

this.query().dataSourceTable(tableNum(SecurityUserRole)).addRange(fieldNum(SecurityUserRole, AssignmentStatus)).value(queryValue(RoleAssignmentStatus::Enabled));
this.query().dataSourceTable(tableNum(SecurityRole)).addRange(fieldNum(SecurityRole,Name)).value('!Utilisateur système');//to display roles except UserSystem

super();
}

I add executeQuery in eukMatrixRole :

public void executeQuery()
{

this.query().dataSourceTable(tableNum(EUKMatrixRole)).addRange(fieldNum(EUKMatrixRole,MatrixName)).value(queryValue(SecurityRole.Name));//

super();
}

but when I run the form I don't get the exact values from eukmatrixRole according to the securityRole Name:

matrixRole.png

*This post is locked for comments

I have the same question (0)
  • BASMA Profile Picture
    932 on at
    RE: ExecuteQuery Method

    when I use inner join,I get this :

    8321.role.png


    the roles are repeated 

  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at
    RE: ExecuteQuery Method

    Hi BASMA!

    If you use addRange() instead of SysQuery::findOrCreateRange() you should call clearRange() before adding a new range.

    Your code there always add a range, therefore if get executed ten times, you create ten ranges for the same field (with the same of different values)

  • BASMA Profile Picture
    932 on at
    RE: ExecuteQuery Method

    Hi Rustem,

    I use clearRange()  in the both datasources?

  • Verified answer
    Rustem Galiamov Profile Picture
    8,072 on at
    RE: ExecuteQuery Method

    Yes. But i recommend to use SysQuery::findOrCreateRange().

  • BASMA Profile Picture
    932 on at
    RE: ExecuteQuery Method

    how can I use this instruction?

  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at
    RE: ExecuteQuery Method

    SysQuery::findOrCreateRange(this.query().dataSourceTable(tablenum(SecurityUserRole)), fieldnum(SecurityUserRole, AssignmentStatus)).value(queryValue(RoleAssignmentStatus::Enabled));

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

#2
NNaumenko Profile Picture

NNaumenko 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans