Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Integer DataItem

(0) ShareShare
ReportReport
Posted on by 3,051

Hi

 How the below code works



Integer - OnPreDataItem()
IF i <> 0 THEN
  SETRANGE(Number,1,i)
ELSE BEGIN
  SETRANGE(Number,1,1);
  CurrReport.SKIP;
 END;

Thanks

*This post is locked for comments

  • Suggested answer
    ShanAbeywicrema Profile Picture
    ShanAbeywicrema 942 on at
    RE: Integer DataItem

    As Amol said you can use debug and check how it works step by step.

    In your code, "i" should have a value, if it is not equal to 0, integer data item would loop until "i" reach. for instance "i" = 10, then your integer data item would loop 10 times,

    IF i <> 0 THEN

     SETRANGE(Number,1,i)

    But if the "i" is 0, then it run only one time.

    BEGIN

     SETRANGE(Number,1,1);

     CurrReport.SKIP;

    END;

    But I am not sure why did you use CurrReport.Skip here, since it runs only one time if the "i" = 0.

    Post here your dataitem snap-shot to get clear idea.

  • Suggested answer
    Zaid Tariq Profile Picture
    Zaid Tariq 2,270 on at
    RE: Integer DataItem

    Why you are using CurrReport.SKIP; in OnPreDataItem trigger?

  • Suggested answer
    RobertasR Profile Picture
    RobertasR 5,002 on at
    RE: Integer DataItem

    Hi,

    this looks similar to 'number of copies' option. The 'i' is input somewhere (Request Page, or similar) and the DataItem runs the number of times that 'i' equals. If the 'i' is zero then this DataItem runs once.

    Robertas

  • Suggested answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 on at
    RE: Integer DataItem

    Try to use debugger to understand the code step by step

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…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,329 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans