cancel
Showing results for 
Search instead for 
Did you mean: 

If then else suppressing values due to EXISTS function output

nidhi_srivastava22
Active Contributor
0 Kudos

Hi Experts,

I am stuck in a issue, where it the Exists function is returning "true" it is working perfectly fine but if it is returning "false" then the else value passed(10 values in the queue) are suppressed & only the first value is produced as an output.

We need all the 10 values to be passed in the output. Please suggest any workaround.

Thanks,

Nidhi Srivastava

manoj_khavatkopp
Active Contributor
0 Kudos

have you tried using use one as many and repeat the false condition as many times as "money" field.

nidhi_srivastava22
Active Contributor
0 Kudos

Hi Manoj,

Already tried that but when it is coming to main IFTHENELSE function it is working as same.

Thanks,

Nidhi Srivastava

Accepted Solutions (1)

Accepted Solutions (1)

nidhi_srivastava22
Active Contributor
0 Kudos

Hi All,

It didn't worked as expected. Tried a workaround - duplicate node and similar kind of mapping rules. Closing the blog.

Answers (1)

Answers (1)

babruvahana
Contributor
0 Kudos

Hi Nidhi,

If You want to pass all the ten vales, use remove context and splitbyvalue(eachvalue) before passing the values.

Also, try altering the contexts. Both should have the same contexts to pass the same number of values.

When I faced the similar issue, I tweaked contexts of the source field to resolve the issue.

Regards,

Pavan

nidhi_srivastava22
Active Contributor
0 Kudos

Hi Pavan,

Thanks for your suggestion, but remove context along with split by each value is not working(already tried).I played around with context and nothing is working in my case.

What I understand, since the exists is passing 1 FALSE, so the first value is being considered and rest all suppressed.

Let me know if any further suggestion.

Thanks,

Nidhi Srivastava

babruvahana
Contributor
0 Kudos

Hi Nidhi,

Yes, since the exists is passing 1 false you are facing this issue. So you need to have the same context of both input and else fields.

Below screenshots might help, I resolved the same issue recently in one of my requirements.

Before changing contexts and adding splitbyvalue:

After changing contexts and adding splitbyvalue:

Regards,

Pavan

nidhi_srivastava22
Active Contributor
0 Kudos

Hi Pavan,

PFB screenshot where I tried as you suggested. The context were already on the same level, I added splitbyvalue but still i am getting the same result.

Please suggest, if I am mistaking somewhere.

Thanks,

Nidhi Srivastava

babruvahana
Contributor
0 Kudos

Hi Nidhi,

Can you please tell the header node of both the Money fields?

If they are not under same header node, then we need to match the context of money field with the else conditioned money field.

It's just a context issue.

Regards,

Pavan

nidhi_srivastava22
Active Contributor
0 Kudos

Hi Pavan,

The structure is like mentioned below.

Money with EXISTS is coming in InvoiceDetailItem -->UnitPrice -->Money

-<InvoiceDetailOrder>

<InvoiceDetailOrderInfo>

+<InvoiceDetailServiceItem XX>

+<InvoiceDetailServiceItem XX>

Money in ELSE is coming in InvoiceDetailServiceItem -->UnitPrice -->Money

-<InvoiceDetailOrder>

+<InvoiceDetailOrderInfo>

+<InvoiceDetailItem XX>

+<InvoiceDetailItem XX>

Any one node will only be coming either InvoiceDetailItem or InvoideDetailServiceItem.So, accordingly only one Money will be coming in the structure as per the node.

Please suggest.

Thanks,

Nidhi Srivastava

babruvahana
Contributor
0 Kudos

Hi Nidhi,

Remove the context of Money in Exists and keep Money in Else as it is.

If this doesn't work just play with the context of Money in Else.

Else, you have to try using UseOneAsMany to generate the same contexts of Money in Else

Regards,

Pavan.

nidhi_srivastava22
Active Contributor
0 Kudos

Hi Pavan,

This is not working, also I tried with the context but still the same result.

When I am trying with the useoneasmany - it is not working as generating false is again using if then else and the issue remains the same.At the end, only one false is getting generated.

Please suggest if some udf will help.

Thanks,

Nidhi Srivastava

babruvahana
Contributor
0 Kudos

Hi Nidhi,

In my case, it worked.

Can you try altering the mapping logic as below considering only one money field will be populated?

If InvoiceDetailItem exists, then pass the Money in If value, else {add one more if-condition} InvoiceDetailServiceItem exists then pass the Money in else value, else a constant empty value. You can play with context to generate the correct output.

If the above solution doesn't work, then you have to use UDF to generate the contexts.

Regards,

Pavan