Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

find char in string

Posted on by Microsoft Employee

I have made this codeunit which loop though all items and give them a barcode from another codeunit. It works fine unless the barcode contains a '/', but it is fine because i dont need them. 

How can modify this code so it skips the items with a slash ( / ) and dont give them a barcode.

ItemIdentifier.DELETEALL;
Item.FINDFIRST;
REPEAT

    ItemIdentifier.INIT;
    ItemIdentifier.Code := Item."No.";
    ItemIdentifier."Item No." := Item."No.";
    ItemIdentifier.INSERT;
    COMMIT;
    ItemIdentifier.GET(Item."No.");
    ItemIdentifier.GenerateBarCode();    
    ItemIdentifier.MODIFY;

UNTIL Item.NEXT = 0;


*This post is locked for comments

  • Suggested answer
    Jan Veenendaal Profile Picture
    Jan Veenendaal 510 on at
    RE: find char in string

    ItemIdentifier.DELETEALL;

    Item.SETFILTER("No.",'<>*/*');

    IF Item.FINDSET THEN

       REPEAT

           ItemIdentifier.INIT;

           ItemIdentifier.Code := Item."No.";

           ItemIdentifier."Item No." := Item."No.";

           ItemIdentifier.INSERT;

           ItemIdentifier.GenerateBarCode();    

           ItemIdentifier.MODIFY;

       UNTIL Item.NEXT = 0;

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