[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] Increment integer with preceding zeros


>  >> Is there a way to increment an integer like 000001 to end up with
>  >> 000002?  The integer is stored in a MySQL table.
>  >
>  >
>  > Of course, there's a few different ways.  If you give some more details
>  > of what you're trying to do, though, it will be easier to give an
>  > appropriate answer to your question.  Where do you want the increment to
>  > occur, and when, etc?
>
>  I'll give you a bit of code you can use in perl to do it:
>
>  $i = sprintf('%0' . length($i) . 'd', $i + 1);

Thanks a lot everyone.  I went with this:

[tmp new_counter][data variables value counter][/tmp]
[perl no_return=1] $Scratch->{new_counter} =
sprintf("%06d",$Scratch->{new_counter} + 1); [/perl]
[data table="variables" field="value" key="counter" value="[scratch
new_counter]"]

- Grant

>  Peter

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.