Dick:

Can you try this?

Create a simple text file named LIST.DAT

-- CONTENTS OF LIST.DAT

1
12
123
1234
12345
123456

-- END CONTENTS

CREATE TEMPORARY TABLE LIST_OF_NUMS (CHK_NO TEXT 6)

LOAD LIST_OF_NUMS FROM LIST.DAT

SELECT * FROM LIST_OF_NUMS

 CHK_NO 
 -------- 
 1
 12
 123
 1234
 12345
 123456

 SELECT CHK_NO,(TRIM((FORMAT((INT(CHK_NO)),'000000')))) FROM LIST_OF_NUMS

 CHK_NO   (TRIM((FORMAT((INT(CHK_NO)),'000000')))) 
 -------- --------------- 
 1        000001
 12       000012
 123      000123
 1234     001234
 12345    012345
 123456   123456

See if this works for you.

Have a wonderful weekend!

Mike Ramsour
AK Steel Coshocton Works
Quality Department
Phone:  740-829-4340
Cell:  740-502-1659



From:   Dick Fey <[email protected]>
To:     [email protected] (RBASE-L Mailing List)
Date:   06/07/2013 03:50 PM
Subject:        [RBASE-L] - Re: Functions
Sent by:        [email protected]



Must be funky friday, can't seem to get it right.

I have a column with a check number in it.  Could be 1 to six digits, it 
is text
Want that to put that into a new column,  using a column expression, 
that gives me 6 digit checknum with leading 0's

Tried all suggestions, but using a column name either in place of the 
variable or a fixed set of digits will not work.

Thanks all
Dick Fey

On 6/7/2013 2:02 PM, A. Razzak Memon wrote:
> At 02:51 PM 6/5/2013, Dick Fey wrote:
>
>> Works perfectly as you show it, but not if you replace the '321'
>> with a var with the same value.
>
> Here's how ...
>
> SET VAR vValue INTEGER = 321
> SET VAR vNewValue TEXT = (TRIM(FORMAT(.vValue,'000000')))
>
> If used in a report or label, take a look at the "Display Format"
> option of the control property to achieve desired display format.
>
> Have fun!
>
> Very Best R:egards,
>
> Razzak.
>
> www.rbase.com
> www.facebook.com/rbase





Confidentiality Notice
This message is intended exclusively for the individual or entity to which it 
is addressed and may contain privileged, proprietary, or otherwise private 
information.  
If you are not the named addressee, you are not authorized to read, print, 
retain, copy or disseminate this message or any part of it.  If you have 
received this message in error, please notify the sender immediately by e-mail 
and delete all copies of the message.

Reply via email to