Page 1 of 1

Checking leading zeroes.

Posted: Sun Oct 23, 2011 5:50 pm
by saraswati
I have following values for a varchar column:

36804629891, 083647382718

How to find the length of the values ?

How to check if there is any leading zeroes for the values ?

How to take first 10 digits of the numbers?

Re: Checking leading zeroes.

Posted: Sun Oct 23, 2011 5:55 pm
by SURA
1. Len(Column_Name) will give you the length.

2. Do you need to know how may 0's or you need to takeout the 0.
If you want to take out, then you can make the mapped column as Int (You can use the function AsInteger(ColumnName)).

3. Column_Name [1,10] will give you the first 10 char.


DS User

Posted: Sun Oct 23, 2011 8:59 pm
by saraswati
I want to check if there is any leading zeroes......it might be one or two.

How is AsInteger function going to help?

Posted: Sun Oct 23, 2011 9:30 pm
by SURA
My comment 2 is to remove the 0 and not to find. Hope i mentioned that !

Let me know your DS Version.

DS User

Posted: Sun Oct 23, 2011 9:30 pm
by deeplind07
If you read the response properly, SURA said 'If you want to take out, then you can make the mapped column as Int (You can use the function AsInteger(ColumnName)). '

Asinteger() will remove the leading zeroes.

This may not be the best method but you can do
Len(Column_Name)-Len(AsInteger(ColumnName)) to find the number of leading Zeroes.

Posted: Sun Oct 23, 2011 11:01 pm
by ray.wurlod
If there are leading zeroes the first digit in the number will be 0. It is sufficient to test for this.

Code: Select all

Left(InLink.TheNumber,1) = "0"