Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
juraj.misina lets say data is like:
tab1:
load * inline [
bal,conditin,coef
1,0,1
1,<0,2
1,<0,3
1,>0,4
];
tab2:
load
If(conditin=0,(bal*coef),if(Evaluate(bal&conditin),(bal*coef),0)) as "new bal" Resident tab1;
please tell me here what exactly Evaluate(bal&conditin) is doing?
bal&conditin returns
10
1<0
1<0
1>0
Now Evaluate() returns
10 as 10
1<0 means false ie 0
1>0 means true ie -1
bal&conditin returns
10
1<0
1<0
1>0
Now Evaluate() returns
10 as 10
1<0 means false ie 0
1>0 means true ie -1
Hello bmggeddam. It is exactly as senpradip007 says.
when i put fields in chart, the o/p is as follows can u tell me y it happens?@Pradip Sen
bal | coef | conditin | new bal |
1 | 1 | 0 | 0 |
1 | 1 | 0 | 1 |
1 | 1 | 0 | 4 |
1 | 2 | <0 | 0 |
1 | 2 | <0 | 1 |
1 | 2 | <0 | 4 |
1 | 3 | <0 | 0 |
1 | 3 | <0 | 1 |
1 | 3 | <0 | 4 |
1 | 4 | >0 | 0 |
1 | 4 | >0 | 1 |
1 | 4 | >0 | 4 |
Did you use the same expr for "New bal" as in your post?
I am getting different "New bal" compared to above result
Seems like cartesian product, check table viewer if your tables are connected (have a common key field).
If you used the exact script from your first post, then adjust the second load to:
tab2:
load
coef,
If(conditin=0,(bal*coef),if(Evaluate(bal&conditin),(bal*coef),0)) as "new bal" Resident tab1;
To create a connection between the tables.
s,
If
(conditin=0,(bal*coef),if(Evaluate(bal&conditin),(bal*coef),0)) as
"new bal"
s there was no connection juraj, but can u elaborate y it takes cartesian product
This is how QlikView behaves when you put fields from disconnected tables into a tablebox. QV cannot determine a link (because it does not exist), so it shows all possible combinations.
Be careful with this, it can have serious impact on performance (although disconnected tables - data islands - can be useful if properly used).
s juraj, i am asking by taking wat fields in to account; cartesian product is applied at every iteration?