Split Master Datas

kyrioskyrios Member Posts: 4
Hello,

i have following problems.
In the Native Client the master datas (a.e. Customer No.) is sort correctly by number. It looks like so:
1000
2000
0198000
0256000

But when we take the SQL Client, the sort is false. It look like so:
0198000
1000
2000
256000

So i must define a fixed number of this. Also if i say, it should have 8 numbers, the 1000 must look like so: 00001000...

The problem, is, we have not only a number in the master datas. There are also letters in it (a.e. GAE1230). And here should the master data look like so: GAE01230 (when i tell, that it muast have 8 signs).

So my question:
How can i split and fill the missed signs with 0??
I test it with copystr, but i don't know really, how i should do this.

to check, on how many letters are in the master data:
FOR i := 1 TO lengthLoc DO BEGIN
  IF IsNumeric(COPYSTR(noPar,i,i)) THEN  
    EXIT(i);
END;

Hope, you know what i mean and can help me ;-)
thx!

Comments

  • ebsoftebsoft Member Posts: 81
    kyrios wrote:
    Hello,

    The problem, is, we have not only a number in the master datas. There are also letters in it (a.e. GAE1230). And here should the master data look like so: GAE01230 (when i tell, that it muast have 8 signs).

    to check, on how many letters are in the master data:
    FOR i := 1 TO lengthLoc DO BEGIN
      IF IsNumeric(COPYSTR(noPar,i,i)) THEN  
        EXIT(i);
    END;
    

    Hope, you know what i mean and can help me ;-)
    thx!

    Just check where is the first numeric char, count how many "0" you have to add, and use a PADSTR to fill your var with "0" chars between letters and numbers.

    Hope you've understood.

    FB
    Regards,
    Federico

    MBS Specialist since NAV 2.0
    My experiences on Linkedin
  • kyrioskyrios Member Posts: 4
    i know, what i must to do, but i don't know how.
    PADSTR is what i looking for.. thx!!
    =D>
  • ebsoftebsoft Member Posts: 81
    kyrios wrote:
    PADSTR is what i looking for.. thx!!
    =D>

    You're welcome.
    Regards,
    Federico

    MBS Specialist since NAV 2.0
    My experiences on Linkedin
Sign In or Register to comment.