Skip to main content
Announcements
Global Transformation Awards submissions are open! SUBMIT YOUR STORY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Regarding logic for my scenario

Hello Friends,

I appreciate your time.

I am not sure about the logic for my scenario, kindly share your ideas.

I have 2 tables, say

Table1:

Key,

Amount

Table2:

Key,

Amount

Now I have to show the Amount from Table 2 as default in all reports, but in case if there is no amount from Table 2, then I have to show  the Amount from Table 1.

Kindly let me know your ideas.

Kind regards,

Kiru

14 Replies
Not applicable
Author

Look at the JOIN statement and consider bringing those tables together based on your KEY field. But if you want to keep them separate look at the ISNULL() function and use an IF for your expression where you do just what you said.

Not applicable
Author

Load Table1 as Mapping Table

and in Table 2 If(Isnull(Amount)=-1, ApplyMap())

OR

Table1:

Key,

1 as Amount_Flag,

Amount

Concatenate

Table2:

Key,

2 as Amount_Flag

Amount

In Expressions or Resident If(Amount_Flag=2 and Isnull(Amount)=-1,If(Amount_Flag=1,Amount,0),0)

MarcoWedel

Hi,

one solution could be:

QlikCommunity_Thread_142254_Pic1.JPG.jpg

QlikCommunity_Thread_142254_Pic2.JPG.jpg

QlikCommunity_Thread_142254_Pic3.JPG.jpg

hope this helps

regards

Marco

Not applicable
Author

Hello Dalton,

I appreciate your time. It is just a part of my logic and I need to consider my other tables too, I need to do my calculation in the link table which contains both the tables.

I have attached the application for your reference, kindly let me know your suggestions.

Kind regards,

Kiru

Not applicable
Author

Hello Eddie,

Thanks for your time. I have attached my sample script, If possible could you please implement your logic.

I sincerely appreciate your time.

Kind regards,

Kiru

Not applicable
Author

Hello Eddie,

I got partial output. But when Amount in Table 2 is null, it is not showing the amount from Table 1.

I have attached the application, kindly let me know your valuable suggestions.

Kind regards,

Kiru

Not applicable
Author

Try this.. See if it works.

Not applicable
Author

Hello Eddie,

Thanks and I appreciate your time. The only problem with the above script is it is showing both the amount(PO, PR) for the key :1936. But I have to display only PO in this case which is 2971 ( The rule is if PO is present then I have to show only  PO and if not then PR)

Kind regards,

Kiru

marcus_malinow
Partner - Specialist III
Partner - Specialist III

If you don't want the extra values loaded into your data you could use an Exists clause in your data load.

Table

LOAD

Key,

Amount

FROM Table1;

CONCATENATE (Table)

Load Key,

Amount

FROM Table2

WHERE Not Exists (Key);