Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

calculation in load script creating field

Hi all´,

potentially easy solution, need to know how to calculate same value already in load script and by that creating a field.

Example:  (Now I need the possibility to calculate the purple header during the load script)

Field Header:         Order     |         Product      |         Customer       |     Qty. Products on Order     

Field Content:          A                     small                   John                                      2

                                A                      big                      John                                     2


5 Replies
Not applicable

Re: calculation in load script creating field

hi ivan,

load

order,

product,

customer,

count(order) as Qty.Products on order

from YOURSOURCE

group by customer,product,order;

hope it helps!

Regards,

Barathiraja

Re: calculation in load script creating field

Hi,

You are asking for table header for this you can use the variable or Calculated labels in the chart. Please share the data if have sample of this.

Ex:-

Qty * Product //As label

Regards

Anand

Not applicable

Re: calculation in load script creating field

Really that easy   ? Now I feel shamed

Will try it was wondering because what I will have multiple different order and customers.

Will try ....

Highlighted

Re: Re: calculation in load script creating field

Hi,

In load script if you use you have to group by by all fields available

Ex:-

Load

Order,

Product,

Customer,

Qty,

Count(Order) as OrderCount,

Qty *  Product as QtyProducts

From Source

Group by

Order,

Product,

Customer,

Qty;

For chart headers you have do like

Order.png

Regards

Anand

Not applicable

Re: calculation in load script creating field

Okay guys,

Example:  (Now I need the possibility to calculate the purple header during the load script)

Red part I have already in my source

TABLE XYZ:

Field Header:         Order     |         Product      |         Customer       |     Qty. Products on Order     

Field Content:          A                     small                   John                                      3

                                A                      big                      John                                     3

                                A                      small                    John                                    3

                                B                      small                    Paul                                      1

This works:

TEST:
LOAD
A,
count(A) as QTY_A
RESIDENT TABLE_XYZ
group by A;

A     3

B     1

This doesn't work:

TEST:
LOAD
A,
count(A) as QTY_A,
if(wildmatch(PRODUCT,'small'),count(A),0) as QTY_small,
if(wildmatch(PRODUCT,'big'),count(A),0) as QTY_big
RESIDENT TABLE_XYZ
group by A;

expected result  

A   3    2   1

B   1    1    0

Community Browser