Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Load script calculations

Hi guys,

I wanted to ask you the suggestions about the most efficient way of making calculations in script task, like, arithmetic operations on different accounts.

For example, I have a table:

LOAD * INLINE [
Account, Property1, Amount
a1, k, 2
a1, k, 4
a1, m, 4
a1, m, 4
a2, k, 18
];

What I actually need is a new account a3 = a1 - a2. This expression means a3 = a1,k - a2,k = 6 - 18.

The formulas I have to deal with often look like this:

R300 = IIF(A400 = 0 or R401 is NULL,
0,
(Z500 * R501 + R401) / A400 + ValidatedAccountA
),
where all the R accounts are parents of some other calculated accounts, Z500 is a purely calculated formula and A400 is a simple input account. R300 is one of the calculated accounts used in the hierarchy.

What is the best way of recalculating these data? Using the calculations in the chart expression is not an option since I have a couple of hundreds of account to recalculate inside a hierarchy and its hierarchical complexity hinders the use of chart expressions, so I was thinking about doing it directly in the load script.

Moreover, the real data table contains a dozen of millions of records, so I would also like to make the script run fast.

Thanks in advance,

Valera



1 Solution

Accepted Solutions
spsrk_84
Creator III
Creator III

Hi,

I feel do all the calculations at the script level itself if u do the at the chart level definitely it will result in OUT OF OBJECT MEMEORY EROR", and if u r using incremental load then it will not be a problem .

View solution in original post

2 Replies
spsrk_84
Creator III
Creator III

Hi,

I feel do all the calculations at the script level itself if u do the at the chart level definitely it will result in OUT OF OBJECT MEMEORY EROR", and if u r using incremental load then it will not be a problem .

Anonymous
Not applicable
Author

Hi ajay,

indeed, you are right. I actually had to make all the calculations on the script level. I had to create around 20 thousand lines of script code to load all the data... 😕

Thanks for the suggestion. 🙂

Valera