Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

swarup_malli
Valued Contributor

Passing current selection from list box to a variable used in straighttable

!I was hoping if i could get some assistance regarding this requirment.

I need to pass selected values from list box to  variable being  used in straight table.

ex:

lets say the label I'm using is

    = vCurrentYear & ' '& 'Donors'

I need to pass values from a listbox called campaignyear which contains values from 2007 to 2011. to the variable (vCurrentYear).

I'm using qlikview version 9.

the expression for column 2010 is :

sum({$<CAMPAIGNYEAR = {$(=num(vCurrentYear))},TrackParm.CAMPAIGNSTATUS = {"F"},TrackParm.CAMPAIGNACCOUNT = {"18"},TrackParm.CAMPAIGNTYPE= {"empl"}>}TrackParm.NUMBEROFDONORS))

the expression for column 2009 is :

sum({$<CAMPAIGNYEAR = {$(=num(vCurrentYear -1))},TrackParm.CAMPAIGNSTATUS = {"F"},TrackParm.CAMPAIGNACCOUNT = {"18"},TrackParm.CAMPAIGNTYPE= {"empl"}>}TrackParm.NUMBEROFDONORS)).

When I choose year 2008 , the 2 colomn expressions must show me sum of sales for year 2008 and 2007.

  if i choose 2011 , i need the expresssion to show me sum of sales for 2011 and 2010.

Thank you

Swarup

1 Solution

Accepted Solutions
rahulgupta
Contributor III

Passing current selection from list box to a variable used in straighttable

try this:

vCurrentYear=GetFieldSelections(Year)

For current Year Selection:

sum({$<CAMPAIGNYEAR = {$(vCurrentYear)},TrackParm.CAMPAIGNSTATUS = {"F"},TrackParm.CAMPAIGNACCOUNT = {"18"},TrackParm.CAMPAIGNTYPE= {"empl"}>}TrackParm.NUMBEROFDONORS))

2 Replies
rahulgupta
Contributor III

Passing current selection from list box to a variable used in straighttable

try this:

vCurrentYear=GetFieldSelections(Year)

For current Year Selection:

sum({$<CAMPAIGNYEAR = {$(vCurrentYear)},TrackParm.CAMPAIGNSTATUS = {"F"},TrackParm.CAMPAIGNACCOUNT = {"18"},TrackParm.CAMPAIGNTYPE= {"empl"}>}TrackParm.NUMBEROFDONORS))

swarup_malli
Valued Contributor

Passing current selection from list box to a variable used in straighttable

Hi Rahul,

   The solution you gave is perfect, I can't thank you enough.

Regards

Swarup