web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

i want to remove leading Zero from PersonnelNumber in HcmWorker Table

(0) ShareShare
ReportReport
Posted on by 335

i want to remove leading Zero from PersonnelNumber in HcmWorker Table,

for example :

PersonnelNumber

0925 to 925

0926 to 926

0927 to 926

number of rows in this table is 6000+

how to do this? and what are after effects after removing 0's, mean to say which table records effected...

thanks in advance.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    How depends on what's the exact logic you want to use. Most likely you want to remove all "0" characters on the beginning of each personnel number. One possible implementation is finding the first non-zero character and use the position in subStr().

    Be aware of that it could (depending on your data) create duplicate values, which would cause the process to fail. You should check for this problem before actually changing any data (and update the logic if needed).

    I'm not sure what you mean by "to say which table records effected". It's done by your code, so you can add any kind of logging you like.

  • Suggested answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Though primary key of this table is based on RecId and majority of other tables which has realtion to HCMWorker are using foreign key relationship, Also on update() method of HCMWorker table, there is code already to update related financial dimensions, so you can give  try to update personnel number by x++. This update will be like writing a normal update query.

    Don't forget to have a backup or transactional DB before attempting this

  • UmesH@ Profile Picture
    810 on at

    Might be Help this code.

    static void LeadingNumberConversion1(Args _args)
    {
        str ppu,rTrim;
        int counter;
        container _trimStr = ["0","."];
        ppu='0000625';
        rTrim = ppu;
        for(counter = 1; counter <= strLen(rTrim); counter++)
        {
         if(confind(_trimStr, strdel(rTrim, 2, strlen(rTrim))))
         {
           rTrim = strdel(rTrim, 1, 1);
           info(strFmt("price per unit=%1",rTrim));
         }
         else
         {
           info(strFmt("price per unit=%1",rTrim));
           break;
         }
        }
    }


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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans