mibuso.com

Microsoft Business Solutions online community
It is currently Wed Jun 19, 2013 6:01 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Generating number
PostPosted: Tue Sep 13, 2011 1:47 pm 
Offline

Joined: Tue Jan 19, 2010 5:23 pm
Posts: 5
Country: Turkey (tr)
Hi All,

I have to create next number from a string like "A000001" -> "A000002"

I'm not talking about number sequence function. I just want to do that. Should I create or find an UDF for it or there is any ready built-in function in Axapta?


Top
 Profile E-mail  
 
 Post subject: Re: Generating number
PostPosted: Wed Sep 14, 2011 1:50 pm 
Offline

Joined: Tue Jan 19, 2010 5:23 pm
Posts: 5
Country: Turkey (tr)
I couldn't found anything about it and wrote that code:

Static str AutoNum(str Num)
{
int i;
int bas;
str b;
;
for (i=StrLen(num);i>=1;i--)
{
b=SubStr(num,i,1);
if (b<"0" || b>"9")
{
bas=i+1;
Break;
}
if (i==1)
bas=1;
}
num=StrReplace(SubStr(num,1,bas-1)+
Num2Str(Str2Num( SubStr(num,bas,StrLen(num) - bas + 1) )+1,
StrLen(num) - bas + 1,0,1,0)," ","0");
Return num;
}


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: