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;
2. How to assign it to integer array with parse text to integer?
Best Regards!
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.
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;
I think what you are looking for is the record.marked and record.markedonly functions:
Hi, thank you all for response! :)
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);
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);
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
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,524 Super User 2024 Season 2
Martin Dráb 228,469 Most Valuable Professional
nmaenpaa 101,148