Skip to Content
0
Apr 26, 2017 at 06:56 PM

How to use substr function with dynamic value ?

86 Views Last edit Apr 26, 2017 at 07:57 PM 3 rev

"Default = 1 if VGW03 is up to 3 decimal places. Else multiply by factor used in VGW03"

We have fields like this..

VGW03

0.00012300000

0.0001230

0.001346

0.0006

"Default = 1 if VGW03 is up to 3 decimal places. Else multiply by factor used in VGW03" is one change in my job.

VGW03 is a fields with decimal values(0.006400000,14.000650000 like etc..) and I have to pass the value as per the above logic.

As per my understanding we can use..

ifthenelse(table1.VGWO3='0.000',table1.VGWO3, Substr(lenght(rtrim(table1.VGWO3,'0')-3,'1','12'))

we have to use like this but some where it went wrong !! facing syntax error and also if more than 3 decimal value we have to multiply by factor as dynamically as per the above condition. how to made the changes for this please comment If any one have any idea !!