Skip to main content

Notifications

Announcements

No record found.

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

MultiSelectionHelper Return Only 1 Record

(0) ShareShare
ReportReport
Posted on by 419

Hello friends, 

I m turning to find how to fix an issue.

When i use Multiselectionhelper its return only 1 record.

Do you know what could be the cause ?

When i put an info in the while loop, i'm getting displayed the good values selected.

Thanksfully.

PS : Here is a screenshot of my debug, it's written on my querybuilddatasource query : Select firstfast forupdate .... is it my issue ?

pastedimage1646732755662v1.png

  • Azeem chisty Profile Picture
    Azeem chisty 25 on at
    RE: MultiSelectionHelper Return Only 1 Record

    I hope you are calling method getnext() from MultiSelectHelper class

    Before the end of while loop mention of selectionhelper.getnext(); so that helper class will go to the next selected records

    example:
    while(tablebuffer)

    {

         //...//
         //...//

         selectionHelper.getnext();

    }

  • Awaxx Profile Picture
    Awaxx 419 on at
    RE: MultiSelectionHelper Return Only 1 Record

    nmaenpaa

    You re right again, my problem come from my query. I found the issue but still didnt get the way to resolve it. Thank you again.

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: MultiSelectionHelper Return Only 1 Record

    I'm sorry but I don't understand this explanation.

    Also if you can't follow the instructions that we gave earlier, you should ask for more help (in those discussions) instead of constantly trying completely new approaches.

    What we have explained before is the "best practice". And what you're trying to do now doesn't seem like that (but since I don't understand it, I might be wrong).

    I hope you find a solution to your business problem, but I don't have any new inputs at this point.

  • Awaxx Profile Picture
    Awaxx 419 on at
    RE: MultiSelectionHelper Return Only 1 Record

    nmaenpaa 

    I am on a new form and first i used the way you and Martin teached me before.

    It worked for my first task but here i'm not getting the same.

    Here i changed the way i m making it to reach best practice way.

    so first I get the caller datasource from my Display menu item button by changing datasource property on this button.

    Then i override the init method of the opening form to be filtered.

    But here the difference is that i wanna get the same values from the rows i selected in form A Grid and getting it on Form B.

    I tried what i learned before and other ways even with select statement but didnt get it

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: MultiSelectionHelper Return Only 1 Record

    Ok, so this seems to be yet another question about the same topic that we already discussed several times (filter a form based on many selected records in the caller form).

    You can't do such filtering without the query based approach that we already provided to you. Were you not able to solve your business requirement with the help that we already provided?

    community.dynamics.com/.../how-to-deal-with-multiselecthelper-on-clicked-event

    community.dynamics.com/.../how-to-convert-from-set-type-to-int

    community.dynamics.com/.../how-to-deal-with-element-args-parmobject-and-process-query-on-it

    If you want to select by one selected record in the caller form, table relations handle it for you.

    If you want to filter by multiple selected records in the caller form, you need to add multiple ranges to the query of the form that is opened.

    Your issue has nothing to do with "MultiSelectionHelper returning only one record". I'm sure that your MultiSelectionHelper returns all the selected records of the data source that you pass to it.

  • Awaxx Profile Picture
    Awaxx 419 on at
    RE: MultiSelectionHelper Return Only 1 Record

    Hi nmaenpaa

    What i m meaning is why i m getting in my info the good values, but when i m reaching the form i m having only one of those seleted rows.

    What i wanna do is only having in the child form the seleted values i select before in the parent form

    Is there an easy way do that without query or filtering, cause i wanna get the same values but in a new form

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: MultiSelectionHelper Return Only 1 Record

    Hi,

    I'm not sure if I understand your question. Are you sure that you're debugging the correct thing? In your screenshot we can see a breakpoint that has nothing to do with the MultiSelectionHelper that you initialize later in the code.

    You also say "When i put an info in the while loop, i'm getting displayed the good values selected.", which seems to indicate that the MultiSelectionHelper works correctly. But I can't be sure, since your screenshot doesn't contain any code that would print to infolog.

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!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans