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

No. Of copies-AL

(0) ShareShare
ReportReport
Posted on by 3,045

Hi everyone,

Can you please update how we can use No. of copies feature in D365 BC using AL.

I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    133 on at

    You have a dataitem for the integer table which is controlled by a variable. Code for the triggers on this dataitem, generally called copyloop:

    OnAfterGetRecord()

                   begin

                       if Number > 1 then begin

                           CopyText := FormatDocument.GetCOPYText;

                           OutputNo += 1;

                       end;

                   end;

    OnPreDataItem()

                   begin

                       NoOfLoops := Abs(NoOfCopies) + 1;

                       if NoOfLoops <= 0 then

                           NoOfLoops := 1;

                       CopyText := '';

                       SetRange(Number, 1, NoOfLoops);

                       OutputNo := 1;

                   end;

               }

    Note the setrange on Number. That stops an infinite loop the noofcopies integer variable needs to be on the request page

    requestpage

       {

           SaveValues = true;

           layout

           {

               area(content)

               {

                   group(Options)

                   {

                       Caption = 'Options';

                       field(NoOfCopies; NoOfCopies)

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 3,151

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,443 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,092 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans