Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Bar Chart - Default selection on clear to Max(Year)

Hi All,

Below is the expression which I am using. But when clear button is clicked then the default data for max of year should display. how to achieve this?

Count({<Account_Table_ACSAT.Responded={'yes', 'Yes'}, Account_Table_ACSAT.Q2_Score={6,7},Year = {$(=only(Year))},Month=,Quarter=,Day=>} Account_Table_ACSAT.Responded)
/
Count({<Account_Table_ACSAT.Responded={'yes', 'Yes'},Year = {$(=only(Year))},Month=,Quarter=,Day=>} Account_Table_ACSAT.Responded)

Any help would be appreciated.

Thanks in advance!

Regards,

Ankita

Tags (1)
7 Replies
sushil353
Honored Contributor II

Re: Bar Chart - Default selection on clear to Max(Year)

Hi Ankita,

Use Max() or Maxstring()  function instead of only()..

Only() function returns null when there are duplicate of multiple same values

HTH

Sushil

Not applicable

Re: Bar Chart - Default selection on clear to Max(Year)

Thanks Sushil!

Apart from this may I know how to make default selection of year, quarter in a calendar to max year and max quarter. whenever application is logged in.

Not applicable

Re: Bar Chart - Default selection on clear to Max(Year)

You can add action to select the max year in OnOpen trigger.

Not applicable

Re: Bar Chart - Default selection on clear to Max(Year)

Thanks for reply!

Please guide with steps.

But this should clear this selection when clear button is cilcked.


MVP
MVP

Re: Bar Chart - Default selection on clear to Max(Year)

Hi


No need to mess about with triggers and actions, As per Sushil Kumar's reply this should work:


Count({<Account_Table_ACSAT.Responded={'yes', 'Yes'}, Account_Table_ACSAT.Q2_Score={6,7},Year = {$(=max(Year))},Month=,Quarter=,Day=>} Account_Table_ACSAT.Responded)
/
Count({<Account_Table_ACSAT.Responded={'yes', 'Yes'},Year = {$(=max(Year))},Month=,Quarter=,Day=>}Account_Table_ACSAT.Responded)


Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable

Re: Bar Chart - Default selection on clear to Max(Year)

1. For On open document defaults:

Settings -> Document Properties -> Triggers -> OnOpen -> Add Action(s) -> Add

Then:

Action type: "Selection"
Action: "select in Field"

Insert in Field: Account_Table_ACSAT.Responded
insert in Search String: Yes

2. For clear buttons / reset buttons to default:

Right click on the button -> properties -> Actions -> Add

Then:

Action type: "Selection"
Action: "select in Field"

Insert in Field: Account_Table_ACSAT.Responded
insert in Search String: Yes

Good practice to "Clear All" or  Enter blanks before values e.g


Insert in Field: Account_Table_ACSAT.Responded
insert in Search String:

a1.JPG

a2.JPG

a3.JPG

Not applicable

Re: Bar Chart - Default selection on clear to Max(Year)

I want in calendar year selection as Current Year.

So,I have taken Field as Year and Search String as Max(Year).

But this is not working. When I open the application.

Community Browser