Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
krishna20
Specialist II
Specialist II

Expression in script

Hi Friends,

I need to calculate simple division at script level but,the fields from different tables.I have used mapping concept to achieve this. Is this correct approach. when i reloads the script raising error as "Invalid Expression". Can anyone please suggest me where i goes wrong.

PolA:

MAPPING LOAD

     TP_BI_ID,

     TP_DISC_LC_1 as POL_DISC_LC_1;

FROM

[..\QVD\Pol.QVD]

(qvd);

Risk:

LOAD * ,

(SUM(trim(POL_DISC_LC_1))/COUNT(DISTINCT TR_RISK_SR_NO)) as RISK_DISC_LC_1;

LOAD 

     TR_BI_ID,

     TR_TP_BI_ID,

     TR_RISK_SR_NO,

ApplyMap ('PolA',TR_TP_BI_ID,Null()) as POL_DISC_LC_1

FROM

[..\QVD\RISK.QVD]

(qvd);

Regards

Krishna

28 Replies
krishna20
Specialist II
Specialist II
Author

Hi Michael,

Thank you very much. It's working perfectly !!.I understood my mistake.

Anonymous
Not applicable

One of the reasons I moved applymap() out of the initial load was to make it faster.  With this function QVD load is non-optimized.

krishna20
Specialist II
Specialist II
Author

Ya after moving that apply map and expression in a single line only it's working for me..

krishna20
Specialist II
Specialist II
Author

Hi,

Sorry i didn't noticed this mistake yesterday. After including Group By clause like above. Risk table is losing it's joining characteristics  ,even there is same field in the policy table.Please find the image and suggest me.

Regards

krishna

krishna20
Specialist II
Specialist II
Author

Hi     gwassenaar  Sir,

Please guide me why it happens after using Group by clause?

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

There are no fields that occur in both tables. There's a field TR_BI_ID in the risk table and a field TP_BI_ID in the policy table, but the names are different so it isn't used to link the tables. Perhaps you want to rename one or more fields.


talk is cheap, supply exceeds demand
krishna20
Specialist II
Specialist II
Author

Hi,

In the risk table there is a field TR_TP_BI_ID. It's renamed as TP_BI_ID. you can see in the above attached image.

It is not linking to the policy table.Sorry if i'm wrong.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

But in the top load you didn't add that renamed field, so it's not added to the final table. And don't forget to add it to the GROUP BY clause too.


talk is cheap, supply exceeds demand
krishna20
Specialist II
Specialist II
Author

Hi,

Thank you Gysbert for helping in the right time. It's working.Once again thank you very much.