Page 1 of 1

How to write substring option in transformar with if conditi

Posted: Tue Apr 07, 2009 9:53 am
by deesh
Please can help in this canse

if OKCSCD in('DE') then substring(OKCUA4,7, end) else Blank

Posted: Tue Apr 07, 2009 10:04 am
by chulett
Then OKCUA4[7,len(OKCUA4)] Else

Or something similar with Right().

Posted: Tue Apr 07, 2009 1:19 pm
by ray.wurlod

Code: Select all

If Index("DE", InLink.OKCSCD, 1) Then Right(InLink.OKCUA4, Len(InLink.OKCUA4) - 6) Else ""

Posted: Tue Apr 07, 2009 3:08 pm
by chulett
Now, that depends on how you read the 'IN' statement in the OP. As written, it is syntactically equivalent to if OKCSCD = 'DE' but if you read it as if OKCSCD like '*DE*' or that the field contains the substring 'DE' then the Index() is appropriate.

Posted: Tue Apr 07, 2009 5:37 pm
by ray.wurlod

Code: Select all

Index("DE", InLink.OKCSCD, 1)
is the same as

Code: Select all

("DE" = InLink.OKCSCD) Or ("D" = InLink.OKCSCD) Or ("E" = InLink.OKCSCD) 

Posted: Tue Apr 07, 2009 9:46 pm
by chulett
Ah... didn't notice you had the arguments 'backwards'. :wink: