Hi Gary,

 

How about this.

 

As you have leading zeros you must have the numbers in a character field.
Copy them into an integer field to drop the leading zeros and then copy back
to a character field and apply the following logic by doing a character
count.

 

If there is one character left rpad four zeros

If there are two characters rpad by three zeros and replace the last
character with a zero.

If there are three characters left rpad by two zeros and replace the last
two characters with zeros

If there are four characters left rpad by one zeros and replace the last
three characters with zeros

If there are five characters left  replace the last three characters with
zeros

 

Regards

Brian 

 

 

 

From: Action Request System discussion list(ARSList)
[mailto:[EMAIL PROTECTED] On Behalf Of Chintan Shah
Sent: 12 September 2008 17:09
To: arslist@ARSLIST.ORG
Subject: Re: Help parsing a string in a set fields

 

** 


Hi Gary,

You got my brain cells working on friday...thanks for that. 

Try the following out  for first 5 scenarios.

Set fields on the field that needs to be set in following sequence.

1.LEFTC($FIELD$, 2)
2 RPADC($FIELD$, 5,  "0")

Still working on other scenarios..just wanted to through this out, see if
that works.

Thanks
Chintan.





--- On Fri, 9/12/08, Shoemaker, Gary <[EMAIL PROTECTED]> wrote:

From: Shoemaker, Gary <[EMAIL PROTECTED]>
Subject: Help parsing a string in a set fields
To: arslist@ARSLIST.ORG
Date: Friday, September 12, 2008, 7:03 AM

** 

I am trying to do set a field to specific format using the functions but can
not get exactly what I want.  It is a 5 character string and  needs  to end
up as a 5 character string.  The pattern is that I leave all leading 0 and
pad right up to 3 - the number of leading 0 if leading is more than 1.

Any suggestion on this would be greatly appreciated.

12566 goes to 12000

11456 goes to 11000

10456 goes to 10000

09456 goes to 09000

08456 goes to 08000

00956 goes to 00900

00096 goes to 00090

00009 goes to 00009

 

 

 

 

 

 

However beautiful the strategy, you should occasionally look at the results.


Sir Winston Churchill

 

 

 

 

__Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"
html___ 


__Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"
html___ 


_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"

Reply via email to