Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

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

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)?
  • Community member Profile Picture
    Community member 11 on at
    A form with header/lines grids, shows lines when no header selected.
    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).
  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,547 Super User 2024 Season 1 on at
    A form with header/lines grids, shows lines when no header selected.
    Hi, Please check this article
     
     
    Thanks
    Mohit
  • Verified answer
    A form with header/lines grids, shows lines when no header selected.
    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.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans