Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Error - End should come here

Posted on by 3,027

Hi

  I have below code and it gives above error . Secondly if found then want to exit from the loop.

ValuePresent := FALSE;
FOR i := 1 TO 10 DO
BEGIN
   BEGIN
       IF ArrReceipt [i] = "Purch. Inv. Line"."No." THEN
       ValuePresent:=TRUE;
   END
IF ValuePresent:=False
ArrReceipt [i] := "Purch. Inv. Line"."No.";
END;
message('%1',ArrReceipt[i]);

Thanks

*This post is locked for comments

  • mmv Profile Picture
    mmv 11,465 on at
    RE: Error - End should come here

    FOR i := 1 TO 10 DO BEGIN

      IF arrReceipt [i] = "Purch. Inv. Line"."Document No." THEN BEGIN

         ValuePresent := TRUE;

         i := 10;

      END ELSE

         arrReceipt [i] := "Purch. Inv. Line"."Document No.";

    END;

    MESSAGE('%1',arrReceipt [i]);

  • Verified answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Error - End should come here
    FOR i := 1 TO 10 DO BEGIN
       BEGIN
        IF arrReceipt [i] = "Purch. Inv. Line"."Document No." THEN BEGIN
          ValuePresent:=TRUE;
          i := 10
       END
       IF NOT ValuePresent THEN
        arrReceipt [i] := "Purch. Inv. Line"."Document No.";
    END;

    Please try the above code.

  • Suggested answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 on at
    RE: Error - End should come here

    [quote user="jsshivalik"]

    Hi

      I have below code and it gives above error . Secondly if found then want to exit from the loop.

    ValuePresent := FALSE;
    FOR i := 1 TO 10 DO
    BEGIN
       BEGIN
           IF ArrReceipt [i] = "Purch. Inv. Line"."No." THEN
           ValuePresent:=TRUE;
       END;
    IF ValuePresent:=False THEN 
    ArrReceipt [i] := "Purch. Inv. Line"."No.";
    END;
    message('%1',ArrReceipt[i]);

    Thanks

    [/quote]

    Check this line in red

  • jsshivalik Profile Picture
    jsshivalik 3,027 on at
    RE: Error - End should come here

    Hi

     ValuePresent Type is Boolean. Secondly how to exit if ValuePresent True.

    Can u pls guide how this code works.

    I have written below code but it is not working

    FOR i := 1 TO 10 DO
    BEGIN
       BEGIN
        IF arrReceipt [i] = "Purch. Inv. Line"."Document No." THEN
          ValuePresent:=TRUE;
       END
       IF NOT ValuePresent
        arrReceipt [i] := "Purch. Inv. Line"."Document No.";
    END;
    message('%1',arrReceipt[i]);


    Thanks

  • Verified answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Error - End should come here

    IF ValuePresent := FALSE is wrong it should IF NOT ValuePresent if Boolean if the value is text IF ValuePresent = 'False' THEN

    it is missing then

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans