Skip to Content
0

Using Ifthenelse in BODS

Apr 13 at 03:32 PM

42

avatar image

Hi All,

Im trying to modify my query below:

ifthenelse(ENR_DataObjectCrossRefence( 'ENGC05', Q_Enrich1.EQUNR || '|' || Q_Enrich1.ENGC05_EQTYP || '|' || Q_Enrich1.ENGC05_SWERK, Q_Enrich1.DI_SOURCE_SYSTEM ) is null, ENR_DataObjectCrossRefence( 'ENGC05_SUB', Q_Enrich1.EQUNR || '|' || Q_Enrich1.ENGC05_SUB_EQTYP || '|' || Q_Enrich1.ENGC05_SUB_SWERK, Q_Enrich1.DI_SOURCE_SYSTEM ), null)

What this does is that it just takes the parameters and check if it is ENGC05 or ENGC05_SUB and return data from an XREF table.

Now the needed changes is that if the first function returned null it will then re run the function with the other ENGC05_SUB parameter so that it will not return null.

This is what my proposed logic looks like but I cant seem to properly input it in the query.

X = ENR_DataObjectCrossRefence(

'ENGC05',

Q_Enrich1.EQUNR || '|' || Q_Enrich1.ENGC05_EQTYP || '|' || Q_Enrich1.ENGC05_SWERK,

Q_Enrich1.DI_SOURCE_SYSTEM)

If (nvl(x,’’)=’’)

Begin

X = ENR_DataObjectCrossRefence(

'ENGC05_SUB',

Q_Enrich1.EQUNR || '|' || Q_Enrich1.ENGC05_SUB_EQTYP || '|' || Q_Enrich1.ENGC05_SUB_SWERK,

Q_Enrich1.DI_SOURCE_SYSTEM

End

Return x

Could anyone help me with this?

SQL
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Akhilesh Kiran Apr 18 at 03:17 PM
0

Hi Nicolo Punzalan,

/*Create a NewOutput Columns*/
Query_1 : New Output Columns
ENR_DataObjectCrossRefence_ENGC05 
Mapping : 
nvl('ENGC05',Q_Enrich1.EQUNR || '|' || Q_Enrich1.ENGC05_EQTYP || '|' || Q_Enrich1.ENGC05_SWERK,Q_Enrich1.DI_SOURCE_SYSTEM,'') 


ENR_DataObjectCrossRefence_ENGC05_SUB
Mapping :
'ENGC05_SUB',Q_Enrich1.EQUNR || '|' || Q_Enrich1.ENGC05_SUB_EQTYP || '|' || Q_Enrich1.ENGC05_SUB_SWERK,Q_Enrich1.DI_SOURCE_SYSTEM


/*If Then Else logic*/ 
Query_2 : Mapping Logic Mapping Logic of IfThenElse. I belive that "ENGC05" and "ENGC05_SUB" are columns. 
Output Coulmn : ENR_DataObjectCrossRefence 
Mapping : 

ifthenelse(ENR_DataObjectCrossRefence_ENGC05 = '',ENR_DataObjectCrossRefence_ENGC05_SUB,ENR_DataObjectCrossRefence_ENGC05)

Regards,
Akhilesh Kiran.

Share
10 |10000 characters needed characters left characters exceeded