Skip to main content

Notifications

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

How to convert from Set type To int ?

(0) ShareShare
ReportReport
Posted on by 207

Hi friends,

Do someone know how to convert records from Set Type to Int ?

Thanksfully.

  • Awaxx Profile Picture
    Awaxx 207 on at
    RE: How to convert from Set type To int ?

    Thank you very much ... i didnt figure how to do that

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to convert from Set type To int ?

    SetEnumerator setEnum = setOfRecords.getEnumerator(); // setOfRecords is the one that you have
    Set setOfRecIds = new Set(Types::Int64);
    
    while (setEnum.moveNext())
    {
        MyRecord myRecordLocal = setEnum.current();
        setOfRecIds.add(myRecordLocal.RecId);
    }

  • Awaxx Profile Picture
    Awaxx 207 on at
    RE: How to convert from Set type To int ?

    Yes that what i want to do ... but i'm still newbie on D365 and i dont find the right way to code that

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to convert from Set type To int ?

    I'm still not sure that I understand.

    If you need  to access selected records of form A on form B you can do it directly by using the caller data source. You don't need any sets.

    Anyway, if you have a set of records, and you want to also have a set of rec ids of those records, you should be able to solve it by using your current skills. Just fetch each record from the set, and add it's RecId to another set (of type Int64).

  • Awaxx Profile Picture
    Awaxx 207 on at
    RE: How to convert from Set type To int ?

    Yes i was doing that on form A :

            eukSelectedMenus  = selectionHelper.getFirst();
    
            if (eukSelectedMenus.RecId)
            {
                while (eukSelectedMenus.RecId != 0)
                {
                    selectedRecords.add(eukSelectedMenus);
                    eukSelectedMenus = selectionHelper.getNext();
                }
            }
            
            args.parmObject(selectedRecords); //Assign to args values

    My problem is to get that values on form B and deal with it to make some query on RecId for example

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to convert from Set type To int ?

    So you have a set of records, and you want to get recIds of those records?

    Did I understand correctly?

  • Awaxx Profile Picture
    Awaxx 207 on at
    RE: How to convert from Set type To int ?

    Yes i wanna pass from form A args().parmObject(SetRecords); to another form B

    And then i wanna try to gives to recId values of the SetRecords that i got

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to convert from Set type To int ?

    Hi,

    could you share any more details about your actual requirement? I'm sure there's some actual scenario/issue that you're working with.

    Sets, records and integers are three completely different things (and can't be converted to each other) so at least I don't understand the question.

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…

Vahid Ghafarpour – Community Spotlight

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

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,160 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans