Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bnelson111
Creator
Creator

Dividing Figures on Script Loads and Multiply

I have recently been doing working on calculations on load script the following works :

((( (((t0."estp-blank-l"*t0."estp-blank-w")/1000000)*t1."estrc-coverage")*(t3.OrderedQty+2500))*t1."estrc-usage")/100000) as "Calculated Ink Kg"

However a simple divide by as below doesn't?

((t1."estrc-cost")/(t1."estrc-weight-qty")) as unit,

But same statement will multiply?

((t1."estrc-cost")*(t1."estrc-weight-qty")) as unit,

Thanks Brett

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

In your other question (Table Links and Sums in Scripts, Create new field.) you have this expression inside a SQL SELECT. Maybe this is the problem? Any calculation inside a SELECT statement is executed by the ODBC driver and not by QlikView, and there could be limitations e.g. integers that cannot be divided to form new non-integer numbers.

Try a Preceding Load instead:

Load *,

     "estrc-cost"/"estrc-weight-qty" as unit

     ;

SQL SELECT ... FROM ... ;

HIC

View solution in original post

3 Replies
sunny_talwar

Do you have a sample which can show this issue?

Gysbert_Wassenaar

As far as I know that's only possible if t1."estrc-cost is 0 or t1."estrc-weight-qty" is 1.


talk is cheap, supply exceeds demand
hic
Former Employee
Former Employee

In your other question (Table Links and Sums in Scripts, Create new field.) you have this expression inside a SQL SELECT. Maybe this is the problem? Any calculation inside a SELECT statement is executed by the ODBC driver and not by QlikView, and there could be limitations e.g. integers that cannot be divided to form new non-integer numbers.

Try a Preceding Load instead:

Load *,

     "estrc-cost"/"estrc-weight-qty" as unit

     ;

SQL SELECT ... FROM ... ;

HIC