Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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.
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)
Hi,
one solution could be:
hope this helps
regards
Marco
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
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
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
Try this.. See if it works.
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
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);