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

A form with header/lines grids, shows lines when no header selected.

(0) ShareShare
ReportReport
Posted on by 11
I have a form with a header grid and a lines grid. When I select a header in the top grid its lines are shown in the bottom grid. They are matched through a identifier and is working as intended when I select a header.
 
The problem is that when no header is selected (or one does not exist), there are still lines showing. The lines in question are lines that does not match any header id (an error set their id to 0). Why this has happened is another issue, for now I just want them not to be shown when no header is selected.
 
What is the best way to do this, can I add some filter to the relation (only show rows where id field > 0)?
I have the same question (0)
  • Verified answer
    Community member Profile Picture
    on at
    Hi,
     
    You can add a range on the executeQuery method of the lines grid datasource and set the relation between the two tables as a range in the second datasource.
     
    Thanks,
    Girish S.
  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at
    Hi, Please check this article
     
     
    Thanks
    Mohit
  • Community member Profile Picture
    11 on at
    Hello Girish

    I added a range on the executeQuery method of the lines grid datasource as you suggested, this is my line:
     
    this.query().dataSourceTable(tableNum(CustLine)).addRange(fieldNum(CustLine, HEADERID)).value(SysQuery::valueNot("0"));
     
    That seems to have done the trick, I no longer see the id = 0 lines when no header is selected, all seems fine. 
     
    I am not sure how to do the second part:
     
    "and set the relation between the two tables as a range in the second datasource."
     
    Is that needed if it already works? At the moment the header and lines datasource relation is refrecid == recid, how would I set a range in the relation (if it is needed).

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 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans