web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Convert GetSelectionFilter() to array of integer

(0) ShareShare
ReportReport
Posted on by 67

Hi!

I need to split my Text to Integer array. I want to store selected records Id in array.

My Code looks like this:

trigger OnAction()
var
    SalesNoList: Array[10] of Integer; //is there any way to declare unlimited array size?
    Txt: text;
begin
    Txt := GetSelectionFilter();
    SalesNoList := //what here?
end;

procedure GetSelectionFilter(): Text
var
    SalesTable: Record MySalesTable;
    SelectionFilterManagement: Codeunit SelectionFilterManagement;
    RecRef: RecordRef;
begin
    CurrPage.SetSelectionFilter(SalesTable);
    RecRef.GetTable(SalesTable);
    exit(SelectionFilterManagement.GetSelectionFilter(RecRef, SalesTable.FieldNo("Sales No.")));
end;


1. How to declare unlimited array size? 

2. How to assign it to integer array with parse text to integer?

Best Regards!

I have the same question (0)
  • Suggested answer
    DAnny3211 Profile Picture
    11,397 on at

    hi

    look this

    forum.mibuso.com/.../how-to-do-string-split-in-nav

    concerns nav but you can also apply it to BC

    making an unlimited array is not possible

    DANiele

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,111 Moderator on at

    1) The limitation for an array in AL is 1000000 elements and 10 dimensions.

    learn.microsoft.com/.../devenv-array-methods

    2) To assign a text to an integer you have to use the evaluate methode

    Evaluate(SalesNoList[1],YourText);

    learn.microsoft.com/.../system-evaluate-method

  • Alzack18 Profile Picture
    67 on at

    Hi, thank you all for response! :)

    NorthW

    Is there any faster way to get selected records IDs?

    If I select records 1,3,4,5 I get the text "1|3..5". There will be a lot of work in converting this to single values. Isn't there a built-in method in BC that does something like this? :) After all, when we select records and click the standard "Delete", somehow the system does it :D

    When I get those single values I want to pass them to procedure in loop.

    MakeSomething(Id: Integer)

    MakeSomething(1);

    MakeSomething(3);

    MakeSomething(4);

    MakeSomething(5);

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,111 Moderator on at

    I think what you are looking for is the record.marked and record.markedonly functions:

    learn.microsoft.com/.../record-mark-method

    learn.microsoft.com/.../record-markedonly-method

  • Alzack18 Profile Picture
    67 on at

    Problem solved!

    NorthW I didn't use what you pointed out, but thanks to this I found the path to the correct solution!

    My code:

    trigger OnAction()
    var
        SalesTable: Record MySalesTable;
    begin
        CurrPage.SetSelectionFilter(SalesTable);
        SalesTable.Next(); //pass record 0
    
        repeat
            Message('%1', SalesTable."Sales No.");
        until SalesTable.Next() = 0;
    end;


    Thank you all for help.
    Best Regards!

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,111 Moderator on at

    Happy to hear that you got it solved!

    And the best solutions are those you find yourself with someone pointing you in the correct direction.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,238

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 630

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans