Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Modify massive values

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Goodmorning everyone,
I'll explain my problem. I'm trying to create a button to insert into a generic Page (suppose for example that of the articles) that I will need to do "massive" operations on them; for example, I would like to select some articles by pre-filtering them, (eg select all articles starting with * 1234) and apply changes on one (or more) fields of them (eg change the description field to all articles starting with * 1234).
I have reached the point where I can select the desired table and the field to modify, but when I try to make changes to the value of the field in question, I receive errors but I do not understand why ["The Item does not exist. Identification fields and value: No. = ']. I adhered to the guides of the Community, even sifting through the web I always found the same procedure to perform, very very similar to the following (the following code is the one that I really implemented!)

Fields.RESET;
Fields.SETRANGE (TableNo, 27);
Fields.SETRANGE (Enabled, TRUE);
IF PAGE.RUNMODAL (PAGE :: "Field List", Fields) = ACTION :: LookupOK THEN BEGIN
SelectedField: = Fields.FieldName;
FieldNumber: = Fields. "No.";
RecRef.OPEN (27);
FldRef: = RecRef.FIELD (FieldNumber);
  IF FldRef.ACTIVE THEN
  BEGIN
    FldRef.VALUE: = 12345678;
    RecRef.MODIFY;
  END;
END;


SelectedField and FieldNumber are text fields, while RecRef and FldRef are respectively of RecordRef and FieldRef.
Could someone please explain to me politely what error I am committing? Many thanks in advance

*This post is locked for comments

  • Suggested answer
    4BzSoftware Profile Picture
    4BzSoftware 6,071 on at
    RE: Modify massive values

    Hi Mark,

    You can modify massive values of any tables via our tool Universal Excel Import Export at Mibuso:

    mibuso.com/.../universal-excel-import-export

  • Verified answer
    Hannes Holst Profile Picture
    Hannes Holst 5,767 on at
    RE: Modify massive values

    Hi,

    You must select a record for the RecRef.
    In your code, you are trying to modify data of a RecRef which does not link to an existing record.
    See below:

    Fields.RESET;
    Fields.SETRANGE (TableNo, 27);
    Fields.SETRANGE (Enabled, TRUE);
    IF PAGE.RUNMODAL (PAGE :: "Field List", Fields) = ACTION :: LookupOK THEN BEGIN
    SelectedField: = Fields.FieldName;
    FieldNumber: = Fields. "No.";
    
    RecRef.OPEN (27);
    RecRef.SETVIEW(OriginalRecord.GETVIEW); // set your filter here or iterate over all records
    IF RecRef.FINDSET THEN
      REPEAT
        FldRef: = RecRef.FIELD (FieldNumber);
        IF FldRef.ACTIVE THEN
          BEGIN
            FldRef.VALUE: = 12345678;
            RecRef.MODIFY;
          END;
      UNTIL RecRef.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

News and Announcements

Announcing Category Subscriptions!

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans