Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

How can select multiple lines in a checkbox using x++

(0) ShareShare
ReportReport
Posted on by 45

Here the multiselect option is not working.when select a header record the corresponding line should visible.Please help to fix this.

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: How can select multiple lines in a checkbox using x++

    Also, on the SelectionChanged method of SalesTable DataSource call SalesLine_ds.executeQuery()

    Thanks,

    Girish S.

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: How can select multiple lines in a checkbox using x++

    Try the same code in the executeQuery method of the SalesLine DataSource before super class.

    Thanks,

    Girish S.

  • deepak31 Profile Picture
    deepak31 45 on at
    RE: How can select multiple lines in a checkbox using x++

    public int active()
            {
                int ret;
                MultiSelectionHelper helper = MultiselectionHelper::construct();
                helper.parmDatasource(SalesTable_ds);
                SalesTable salesTableLocal;
                salesTableLocal = helper.getFirst();
                while(salesTableLocal.RecId != 0)
                {
                    QueryBuildRange qbr = SalesLine_ds.queryBuildDatasource().addRange(fieldnum(SalesLine, SalesId));
                    qbr.value(queryRangeConcat(qbr.value(),salesTableLocal.SalesId));
                    salesTableLocal = helper.getNext();
                }
                
                ret = super();
            
                return ret;
            }
    

    sir i tried in this way but still it  is not working...iam not getting all the lines for selected hedaers.......

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: How can select multiple lines in a checkbox using x++

    You need to use mutiselect helper class to get the selected records and add its as range to the SalesLine table.

    Add the below code in the active method of the SalesTable DataSource.

    MutliselectHeper helper = MultiselectionHelper:;construct();
    helper.parmDatasource(SalesTable_ds);
    SalesTable salesTable;
    salesTable = helper.getFirst();
    while(salesTable.RecId != 0)
    {
        QueryBuildRange qbr = SalesLine_ds.queryBuildDatasource().addRange(fieldnum(SalesLine, SalesId));
        qbr.value(queryRangeConcat(qbr.value(),salesTable.SalesId));
        salesTable = helper.getNext();
    }

    Thanks,

    Girish S.

  • deepak31 Profile Picture
    deepak31 45 on at
    RE: How can select multiple lines in a checkbox using x++

    I tried this.but still my requirement not satisfied.

    I have a simple form with two DataSources, SalesTable and SalesLine, with SalesLine joined to SalesTable. There is a header and lines grid. The header grid has property MultiSelect = Yes

    When I select 3 SalesTable records from the grid, is there a way to make it display all of the SalesLine records in the lower grid from the three selected SalesTable records in some native style?

    Any one can share the code for this.

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,552 Super User 2024 Season 1 on at
    RE: How can select multiple lines in a checkbox using x++

    Hi Deepak, I think Multi select on header will not display all relevant lines automatically. You need to write code for it.

    Please check this article

    dev.goshoom.net/.../

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: How can select multiple lines in a checkbox using x++

    Hi Deepak,

    If you have proper relation between tables, you will get filter automatically.

    Otherwise add range on the line grid with the value from the header grid in the execute query method of line DataSource.

    Also check whether you have set the join source property on the line DataSource to the header 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

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans