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)?
  • Community member Profile Picture
    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
    12,556 Moderator on at
    A form with header/lines grids, shows lines when no header selected.
    Hi, Please check this article
     
     
    Thanks
    Mohit
  • Verified answer
    Community member Profile Picture
    on at
    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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,280 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,038 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans