cancel
Showing results for 
Search instead for 
Did you mean: 

How to use substr function with dynamic value ?

former_member188381
Participant
0 Kudos

"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 !!

Accepted Solutions (0)

Answers (1)

Answers (1)

raghug
Active Contributor
0 Kudos

It looks like you just copied and pasted a line out of a specification without real context. I am not sure what that statement has to do with substr or dynamic values at all.

What is VGW03? From your explanation, it is numeric data.... if you are trying to use substr to parse the decimals - why? There are countless ways you can derive this mathematically. You could also use MOD & DIV arithmetic operators to help.

former_member188381
Participant
0 Kudos

Hello Raghu,

"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 !!

Please confirm If I am right Page or not !!!

Thanks