Glad to help.

Working from the inside:
        TRUNC($Character Field$) - This takes the character field and 
returns an integer without using a separate integer field, effectively 
chopping off the leading zeros.
 
        (LENGTH(TRUNC($Character Field$)) / 5) - Dividing the length of 
that integer by 5 will return 0 if the length is less than 5, or 1 if it 
is exactly 5.  This is used to factor in the case when there are no 
leading zeroes.

        The length of the integer (without the leading zeroes) subtracted 
from 6 returns the position of the first non-zero digit.  Add the factor 
above in.

        Take the left part of the original string, up to the position 
above.  Any needed zeroes are in the original string.

        And then Pad the right of that to a length of 5.

Have a great weekend!

Thad Esser
Remedy Developer
"Argue for your limitations, and sure enough, they're yours."-- Richard 
Bach



Chintan Shah <[EMAIL PROTECTED]> 
Sent by: "Action Request System discussion list(ARSList)" 
<arslist@ARSLIST.ORG>
09/12/2008 12:15 PM
Please respond to
arslist@ARSLIST.ORG


To
arslist@ARSLIST.ORG
cc

Subject
Re: Help parsing a string in a set fields






** 
Hi Thad,

Thanks a lot!!!!

This was what I was trying to figure out from workflow perspective(only 1 
active link and no new fields)...however...lol..it will take me a good 
amount of time to understand this.

Thanks again..

Regards,
Chintan.

--- On Fri, 9/12/08, Thad K Esser <[EMAIL PROTECTED]> wrote:
From: Thad K Esser <[EMAIL PROTECTED]>
Subject: Re: Help parsing a string in a set fields
To: arslist@ARSLIST.ORG
Date: Friday, September 12, 2008, 11:22 AM

** 
Good thing you asked on a Friday....  :-) 

In one Set Fields, set $Character Field$ to: 
        RPAD(LEFT($Character Field$, (6 - LENGTH(TRUNC($Character 
Field$))) + (LENGTH(TRUNC($Character Field$)) / 5)), 5,  "0") 

Hope that helps.
Thad Esser
Remedy Developer
"Argue for your limitations, and sure enough, they're yours."-- Richard 
Bach 



"Shoemaker, Gary" <[EMAIL PROTECTED]> 
Sent by: "Action Request System discussion list(ARSList)" 
<arslist@ARSLIST.ORG> 
09/12/2008 07:03 AM 

Please respond to
arslist@ARSLIST.ORG



To
arslist@ARSLIST.ORG 
cc

Subject
Help parsing a string in a set fields








** 
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___ 
*IMPORTANT NOTICE: This communication, including any attachment, contains 
information that may be confidential or privileged, and is intended solely 
for the entity or individual to whom it is addressed. If you are not the 
intended recipient, you should delete this message and are hereby notified 
that any disclosure, copying, or distribution of this message is strictly 
prohibited. Nothing in this email, including any attachment, is intended 
to be a legally binding signature. * 
__Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are" 
html___

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

*IMPORTANT NOTICE: This communication, including any attachment, contains 
information that may be confidential or privileged, and is intended solely for 
the entity or individual to whom it is addressed.  If you are not the intended 
recipient, you should delete this message and are hereby notified that any 
disclosure, copying, or distribution of this message is strictly prohibited.  
Nothing in this email, including any attachment, is intended to be a legally 
binding signature.
*

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

Reply via email to