Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Index out of bounds

Posted on by 3,027

Hi

   Below is the code. Accountname,AccountValue has Dimensions = 10

AccountName is Text , AccountValue is Decimal. Secondly i have defined found as Text . What i need to change if i define it as Boolean.

G/L Entry - OnAfterGetRecord()
  Ctr := 0;
      WHILE Ctr <= 9 DO BEGIN
        IF GLEntry."G/L Account Name" =  AccountName[Ctr] THEN BEGIN
          AccountValue[Ctr] += GLEntry.Amount;
          found := 'TRUE';
        END;
        Ctr := Ctr + 1;
      END;
      
      IF found = 'False' THEN BEGIN
        AccountName[g_ctr] := GLEntry."G/L Account Name";
        AccountValue[g_ctr] := GLEntry.Amount;
        g_ctr := g_ctr + 1;
      END;


Thanks

*This post is locked for comments

  • Suggested answer
    Binesh Profile Picture
    Binesh 7,885 on at
    RE: Index out of bounds

    Hello,

    as we suggested assign

     Ctr := 1;

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,137 Super User 2024 Season 2 on at
    RE: Index out of bounds

    try

    Ctr := 1;

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans