Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Mapping in/between the fields in order to do the calculations

Hi all,

I need to create a mapping like this.

plant nameprint center1print line1print center2print line2

D1

33CUX345P-2C32CUX345PCO-2C
D133CUX363P-4C32CUX363PCO-4C
F133LAFP02P-6C32LAFP02PCO-6C
I133INCB79P-6CFOV32INCB79PCO-6CFOV

For each plant, by using this mapping, I should calculate the volume of print line1 divided by the volume of print line2. The calculation should also be available at print center niveau.

All the "print center1 and print center2" (e.g. 33CUX345) are the different elements in the same field"print center".

and all the "print line1 and print line2" are the elements of the same field "print line".

what i wrote down in the script :

Print:

LOAD * INLINE [

_plant, _print_c1, _print_lin1, _print_c2, _print_lin2,

D1, 33CUX345, P-2C, 32CUX345, PCO-2C

...

...

]

The current expression is :

sum({<Version='Actual', Year='2015', Department_code={3}, _Print_lin1={*}, _Print_c1={*}>}Volume)/sum({<Version='Actual', Year='2015', Department_code={9}, _Print_lin2={*}, _Print_c2={*}>}Volume)

To separate the print centre1 and 2, i use their "department_code" ("3" is print center1 and "9" is center2).

For now the calculations don't work...

Does anybody know where the problem is? in the script or in the expression or in both of them?

Many thanks.

Ce message a été modifié par : Q H

8 Replies
ramoncova06
Valued Contributor III

Re: Mapping in/between the fields in order to do the calculations

your set analysis seems to be the problem

you need to add curly brackets to every set

sum({<Version={'Actual'}, Year={'2015'}, Department_code={3}, _Print_lin1={*}, _Print_c1={*}>}Volume)/sum({<Version={'Actual'}, Year={'2015'}, Department_code={9}, _Print_lin2={*}, _Print_c2={*}>}Volume)

Not applicable

Re: Mapping in/between the fields in order to do the calculations

Tks for the comments!

I add them now but still don't work

t_chetirbok
Valued Contributor

Re: Mapping in/between the fields in order to do the calculations

Hi!

Try this

sum({<Version={'Actual'}, Year={2015}, Department_code={3}>}Volume)/sum({<Version={'Actual'}, Year={2015}, Department_code={9}>}Volume).

Or show us some example qvw

Not applicable

Re: Mapping in/between the fields in order to do the calculations

Hi,

thanks but don't work neither

ramoncova06
Valued Contributor III

Re: Mapping in/between the fields in order to do the calculations

ok, put that same expression inside of a text box, does it say if you have an error in it ?

Not applicable

Re: Mapping in/between the fields in order to do the calculations

hello,

Hi, I've attached a simpe qvw and 3 excel files : " Test print.xls" is the database and "result.xls" the table i what to show in the report. In the qvw you could see the calculations are done per plant instead of per line. Thanks to let me know if it's not clear.

Not applicable

Re: Mapping in/between the fields in order to do the calculations

Hi,

i've attached 1 simple qvw and 3 excel files.

Thanks to let me know if it's not clear.

t_chetirbok
Valued Contributor

Re: Mapping in/between the fields in order to do the calculations

Hello!

try this expressions: 1) sum(if(gp_pr=gp,quantity)) 2) sum(if(gp_co=gp,quantity))