Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

afuchten
Valued Contributor

take over main calendar and overrule with set analyses -- help needed!

I'm trying to overrule the main calendar end taking over the selection to another calendar using set analysis.

This is what I came up with ...

count({<

  Calls.StartDate_Year ={$(=if(GetSelectedCount(Year)>0,GetFieldSelections(Year)))},

  Calls.StartDate_Month ={$(=if(GetSelectedCount(Month)>0,GetFieldSelections(Month)))},

  Calls.StartDate_Week ={$(=if(GetSelectedCount(Week)>0,GetFieldSelections(Week) ))},

  Calls.StartDate_Day ={$(=if(GetSelectedCount(Day)>0,GetFieldSelections(Day)))},

  Year=,Month=,Week=,Day=>}

  Callnr

  )

The only problem with this script is that if one of the used fields Year/Month/Week/Day is not selected this is not working.

I need something to resolve the GetSelectedCount(xxx) = 0 ...

anyone got ideas to solve this??

Tags (1)
1 Solution

Accepted Solutions

Re: take over main calendar and overrule with set analyses -- help needed!

What about this:

Count({<

  Calls.StartDate_Year ={$(=if(GetSelectedCount(Year)>0,GetFieldSelections(Year), '*'))},

  Calls.StartDate_Month ={$(=if(GetSelectedCount(Month)>0,GetFieldSelections(Month), '*'))},

  Calls.StartDate_Week ={$(=if(GetSelectedCount(Week)>0,GetFieldSelections(Week), '*'))},

  Calls.StartDate_Day ={$(=if(GetSelectedCount(Day)>0,GetFieldSelections(Day), '*'))},

  Year=,Month=,Week=,Day=>} Callnr)

6 Replies

Re: take over main calendar and overrule with set analyses -- help needed!

What if you use Concat function instead of GetFieldSelections?

Count({<

  Calls.StartDate_Year ={$(=Concat(Year, ','))},

  Calls.StartDate_Month ={$(=Concat(Month, ','))},

  Calls.StartDate_Week ={$(=Concat(Week, ','))},

  Calls.StartDate_Day ={$(Concat(Day, ','))},

  Year=,Month=,Week=,Day=>}

  Callnr

  )

MVP
MVP

Re: take over main calendar and overrule with set analyses -- help needed!

Replace as below

$(=if(GetSelectedCount(Year)>0,GetFieldSelections(Year),Max(Year)))

and so on.

afuchten
Valued Contributor

Re: take over main calendar and overrule with set analyses -- help needed!

in this case the max(year) will give a year selections ... but what i need for 'no field selected' in Year:

{< Calls.StartDate_Year =  >}

and when year is selected I need

{< Calls.StartDate_Year = {$(GetFieldSelections(Year))}, Year= >}



To prevent a lot of coding I want to get it in set analysis ... Else I have to write for every possible selection combination a lot of code ...

afuchten
Valued Contributor

Re: take over main calendar and overrule with set analyses -- help needed!

this doesn't seem to do the trick

Re: take over main calendar and overrule with set analyses -- help needed!

What about this:

Count({<

  Calls.StartDate_Year ={$(=if(GetSelectedCount(Year)>0,GetFieldSelections(Year), '*'))},

  Calls.StartDate_Month ={$(=if(GetSelectedCount(Month)>0,GetFieldSelections(Month), '*'))},

  Calls.StartDate_Week ={$(=if(GetSelectedCount(Week)>0,GetFieldSelections(Week), '*'))},

  Calls.StartDate_Day ={$(=if(GetSelectedCount(Day)>0,GetFieldSelections(Day), '*'))},

  Year=,Month=,Week=,Day=>} Callnr)

Highlighted
afuchten
Valued Contributor

Re: take over main calendar and overrule with set analyses -- help needed!

If doing the same with fields containing strings ... what's the best way?? using the getfieldselections? of using concat?