ASP number formatting

ASP number formatting

Post by skc » Tue, 10 Jun 2003 19:21:57



Using Fp2000 and the DRW, I want to add a number to the
last number in sequence in my Access2000 table.

The number is:  AAA/0002, and I use the <% Right(....,4) %

Quote:> to strip out the number part and add one to it to make

it 0003 (the next one in series).

trouble is... the number becomes a digit...I still want to
retain the leading zeros (4 sig fig) and concatenate it in
the original value:  <% ...&... %>.

How do I format a digit to a 4 sig fig number with leading
zeros???

e.g.

1 = 0001
2 = 0002
....
10= 0010
etc...

thanks,

skc

 
 
 

ASP number formatting

Post by Jon Spive » Tue, 10 Jun 2003 20:04:38


Hi,
something like
<%
intTemp = 123
intTemp = left("0000", 4 - len(intTemp))
' intTemp = 0123
%>

--
Jon
Microsoft MVP - FP


Quote:> Using Fp2000 and the DRW, I want to add a number to the
> last number in sequence in my Access2000 table.

> The number is:  AAA/0002, and I use the <% Right(....,4) %
> > to strip out the number part and add one to it to make
> it 0003 (the next one in series).

> trouble is... the number becomes a digit...I still want to
> retain the leading zeros (4 sig fig) and concatenate it in
> the original value:  <% ...&... %>.

> How do I format a digit to a 4 sig fig number with leading
> zeros???

> e.g.

> 1 = 0001
> 2 = 0002
> ....
> 10= 0010
> etc...

> thanks,

> skc


 
 
 

ASP number formatting

Post by MD » Tue, 10 Jun 2003 20:19:33


It's more like this:

<%
intTemp = 123
intTemp = left("0000", 4 - len(intTemp)) & intTemp
response.write intTemp
%>

Caution: If intTemp exceeds the size of the zero mask it will produce an
error.


> Hi,
> something like
> <%
> intTemp = 123
> intTemp = left("0000", 4 - len(intTemp))
> ' intTemp = 0123
> %>

> --
> Jon
> Microsoft MVP - FP



> > Using Fp2000 and the DRW, I want to add a number to the
> > last number in sequence in my Access2000 table.

> > The number is:  AAA/0002, and I use the <% Right(....,4) %
> > > to strip out the number part and add one to it to make
> > it 0003 (the next one in series).

> > trouble is... the number becomes a digit...I still want to
> > retain the leading zeros (4 sig fig) and concatenate it in
> > the original value:  <% ...&... %>.

> > How do I format a digit to a 4 sig fig number with leading
> > zeros???

> > e.g.

> > 1 = 0001
> > 2 = 0002
> > ....
> > 10= 0010
> > etc...

> > thanks,

> > skc

 
 
 

ASP number formatting

Post by Jon Spive » Tue, 10 Jun 2003 22:12:07


Yes, my mistake. We could check for the number being longer than 4
if len(intTemp) < 4 then intTemp = left("0000", 4 - len(intTemp)) & intTemp

Jon


> It's more like this:

> <%
> intTemp = 123
> intTemp = left("0000", 4 - len(intTemp)) & intTemp
> response.write intTemp
> %>

> Caution: If intTemp exceeds the size of the zero mask it will produce an
> error.



> > Hi,
> > something like
> > <%
> > intTemp = 123
> > intTemp = left("0000", 4 - len(intTemp))
> > ' intTemp = 0123
> > %>

> > --
> > Jon
> > Microsoft MVP - FP



> > > Using Fp2000 and the DRW, I want to add a number to the
> > > last number in sequence in my Access2000 table.

> > > The number is:  AAA/0002, and I use the <% Right(....,4) %
> > > > to strip out the number part and add one to it to make
> > > it 0003 (the next one in series).

> > > trouble is... the number becomes a digit...I still want to
> > > retain the leading zeros (4 sig fig) and concatenate it in
> > > the original value:  <% ...&... %>.

> > > How do I format a digit to a 4 sig fig number with leading
> > > zeros???

> > > e.g.

> > > 1 = 0001
> > > 2 = 0002
> > > ....
> > > 10= 0010
> > > etc...

> > > thanks,

> > > skc

 
 
 

ASP number formatting

Post by skc » Tue, 10 Jun 2003 23:08:54


thanks guys.

Quote:>-----Original Message-----
>Yes, my mistake. We could check for the number being
longer than 4
>if len(intTemp) < 4 then intTemp = left("0000", 4 - len

(intTemp)) & intTemp

>Jon



>> It's more like this:

>> <%
>> intTemp = 123
>> intTemp = left("0000", 4 - len(intTemp)) & intTemp
>> response.write intTemp
>> %>

>> Caution: If intTemp exceeds the size of the zero mask
it will produce an
>> error.



>> > Hi,
>> > something like
>> > <%
>> > intTemp = 123
>> > intTemp = left("0000", 4 - len(intTemp))
>> > ' intTemp = 0123
>> > %>

>> > --
>> > Jon
>> > Microsoft MVP - FP



>> > > Using Fp2000 and the DRW, I want to add a number to
the
>> > > last number in sequence in my Access2000 table.

>> > > The number is:  AAA/0002, and I use the <% Right
(....,4) %
>> > > > to strip out the number part and add one to it to
make
>> > > it 0003 (the next one in series).

>> > > trouble is... the number becomes a digit...I still
want to
>> > > retain the leading zeros (4 sig fig) and
concatenate it in
>> > > the original value:  <% ...&... %>.

>> > > How do I format a digit to a 4 sig fig number with
leading
>> > > zeros???

>> > > e.g.

>> > > 1 = 0001
>> > > 2 = 0002
>> > > ....
>> > > 10= 0010
>> > > etc...

>> > > thanks,

>> > > skc

>.

 
 
 

1. ASP number formatting question...

I have an ASP value within DRW:

<% =FP_FieldVal(fp_rs,"ID") %>

I want the number to be preceeded by zeros (0) if the
number's length <=5.

For instance:

number    how i want it
=====     =============
2         0002
10        0010
233       0233
1334      1334

Is there a function that can do this?

skc

2. Switching identities in XP

3. ASP - Access - Formatting Numbers

4. Have I asked a Duh! Question? (Re: Can I set a mailbox default?)

5. FP 2002 asp format number

6. Arced Text

7. ASP 3.0 Number formatting

8. Info on ithink

9. Formatting A Number To Currency Format

10. Number formatting question

11. Formatting numbers in Database region

12. Format - Numbering inside a Table