How to modify the G/L Account No. when printing a Report

mpmauricempmaurice Member Posts: 6
I have a task to modify the No. field in the G/L Account table using Cal Code . I should not do it manually.
I want to change the No. (Data type is Code) value, For example 00100 to 0000. So in every record I should remove the third figure.
And finally update all the records in the G/L Account table.

I really request to help me out. I was trying to use a report, so that as I print I do the modifications and update the data item, But it has not worked.
Thanks
mpmaurice

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    What did you try which was not working?

    can you show us?
  • rhpntrhpnt Member Posts: 688
    The "No." field in the "G/L Account" table is a primary key field so you have to use the "Rename" function.
  • cmuellercmueller Member Posts: 12
    If you rename the G/L-Account-No.,Navision startet by itself in the background also the change the account-no. in other tables. (G/L Entry, Cust. Ledger Entry...) It could be, that the report therefor running a long time :!:

    regards
    Christian
  • SogSog Member Posts: 1,023
    And don't use the same recvariable of looping the g/l accounts and modifying them. aka don't use the dataitem to rename those!
    And use enough checks to make sure you don't rename the same record twice. (like 12345->1245->125)
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • mpmauricempmaurice Member Posts: 6
    I have tried this code, but it gives me an error G/A Account No. 0000 does not exist, when I run the report.

    Position:=3;
    Length:=1;

    "StringNo." := "No.";
    mycode := DELSTR("StringNo.",Position,Length);
    "No." := mycode;
    RENAME("StringNo.");
  • kinekine Member Posts: 12,562
    "No." := mycode;
    RENAME("StringNo.");
    
    Try to think about these two lines. What they are doing? Why they are there? To which value You want to rename the record?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rhpntrhpnt Member Posts: 688
    Right now some really high profile NAV people are helping you out "mpmaurice", on both of your posts, so don't blow it. Or else it's back to basics...
  • kinekine Member Posts: 12,562
    :mrgreen: I am curious if it will help...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • SavatageSavatage Member Posts: 7,142
    mpmaurice wrote:
    For example 00100 to 0000. So in every record I should remove the third figure.
    And finally update all the records in the G/L Account table.

    So what happens if you have
    00100
    00200
    00300
    etc..

    do you want them all to become 0000?
    Do you just not "like" the numers being used or does it have a business purpose?
  • Alex_ChowAlex_Chow Member Posts: 5,063
    One other thing about renaming is that it messes with the order of report loop or the REPEAT loop. So make sure you're using a key different than the primary key on the table you wish to rename.
  • rhpntrhpnt Member Posts: 688
    kine wrote:
    :mrgreen: I am curious if it will help...
    Guess he blew it...
Sign In or Register to comment.