cancel
Showing results for 
Search instead for 
Did you mean: 

UDF for IF ELSE Condition

Former Member
0 Kudos

Hi All

My requirement is if the condition is true then "Current Date" should pass to Output and if the condition is false "IDTNR" should pass to output "Chassis Number".

Input Values:

Her the condition is true in the 3rd line item. But in the output "Current Date" value is not passing. Instead IDTNR is passed to output.

Output:

I tried using If Without Else and the condition worked ("Current Date" sent to output). But if the condition is false then the output field "Chassis Number" tag is not sent.

Kindly Suggest me to complete this requirement.

Thanks You.

Regards,

Vinoth

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Vinoth,

Add useOneAsMany, IDTNR for the first input and the field E1EDK14 for the 2nd and 3rd input.

Regards,

Mark

Former Member
0 Kudos

Hi Mark,

Thanks for your reply.

I have added useOneAsMany as you mentioned but facing same issue.

If the condition is true i need date alone to be sent to output field.

Please correct me if i'am wrong with the mapping.

Regards,

Vinoth

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Vinoth,

I see. In that case do this, in the if input add sort (descending) and remove the useOneAsMany. What will happen is if there is at least one true, it will output the date.

Regards,

Mark

Former Member
0 Kudos

Hi Mark,

you are right. if i use descending then it is working.

In this case, i have another interface which is using same mapping. if i use descending that interface is disturbed.

Is it possible to use these two identifiers?

E1EDK14

"QUALF = 006" & "ORGID = 30

or

E1EDK14

"QUALF = 015" & "ORGID = YPI0

Regards,

Vinoth

markangelo_dihiansan
Active Contributor
0 Kudos

Yes, this is possible. What you can do is concat QUALF and ORGID and then use the fix values pre-defined function.

Former Member
0 Kudos

Hi Mark,

sorry if i have communicated it wrongly.

I mean to say, we have to use either of the condition to meet this requirement.

IF

E1EDK14

"QUALF = 006" & "ORGID = 30"

Then -> Date

Else -> IDTNR.

I'm not sure how it will work, If i concat QUALF and ORGID and then use the fix values pre-defined function.

Please suggest.

Regards,

Vinoth

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Vinoth,

My answer is still the same , input it like this in fixed values:

Default Value: false

Behavior when lookup fails: Use Default Value

key     value               the key is QUALF concatenated with ORGID

00630     true

015YPI0 true


Regards,

Mark

Former Member
0 Kudos

Hi Mark,

Thanks for your response.

I tried using fixed values and found same issue.

Output:

Regards,

Vinoth

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Vinoth,

Do not remove the sort after the fixed value.

Regards,

Mark

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Vinoth,

The problem here is, IDTNR belongs to a different context when compared to QUALF and ORGID.

If you have all in the same context you should not face such issues. I have tried to replicate the same scenario in a simpler way. Please see the IF else results in the queue.

Thanks & regards,
Nagarajan

anupam_ghosh2
Active Contributor
0 Kudos

Hi Vinoth,

             Can you please post a sample xml input payload, with multiple segments.

Regards

Anupam

Former Member
0 Kudos

Hi Anupam,

Attached sample input xml payload. please check.

Regards,

Vinoth

anupam_ghosh2
Active Contributor
0 Kudos

Hi Vinoth,

               

Can you try this mapping

the udf is like this

This is display queue output

during execution output

Hope this resolves your query.

Regards

Anupam

former_member186851
Active Contributor
0 Kudos

Hello Vinoth,

I guess its because of context changes.

Check the context for both the queues ,use remove contexts,split by value accordingly.

Post  the input queue screenshot.

Former Member
0 Kudos

Hi Raghuraman,

I tried with remove contexts and split by value, but dint work.

Output:

Regards,

Vinoth