Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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

How do I script this?

I have a calendar conrol in my script and a list box in my application showing the Quarter.  The values in the list box are 1,2,3, & 4.  For a calculated dimension, I want to show some data based on the selection of the quarter in the list box.  For example, if the quarter selected = 3, then show X, if the quarter = 4 then show Y, etc.

Thanks,

1 Solution

Accepted Solutions
MVP
MVP

Re: How do I script this?

I'm not a fan of calculated dimensions and I wouldn't reference the selections from the list box.  I'd build it as data.  I assume you have a calendar table with the CAL_QTR field in it.  I would add something like CAL_QTR_MONTH with the values you want.  Something like this, say:

pick(CAL_QTR,'MAR','JUN','SEP','DEC') as CAL_QTR_MONTH,

For performance, it's generally better to do this sort of thing in script than in charts.  From a maintenance standpoint, then it's in one place instead of potentially in multiple charts.  And as a general rule, I'd rather put complexity in my script than in my charts, even if it's the same level of complexity and there's no duplication.  I have a hard time putting my finger on why, though, other than the previous two reasons.

4 Replies
Not applicable

Re: How do I script this?

You can do this with conditional calculations or conditional layouts, depending on what you want your end result to look like. Do you have a sample file of what you are looking to achieve?

Not applicable

Re: How do I script this?

The field for calendar quater in the list box is CAL_QTR, in the calculated dimesion of the chart I am looking for something like,

If the CAL_QTR selected inthe list box =3, then 'SEP', if the CAL_QTR selected = 1, 'MAR',

I am just not sure of the script when trying to reference selections made in the list boxes.

THanks,

Not applicable

Re: How do I script this?

You could use something like this in the conditional layout:

=SubStringCount(Concat(CAL_QTR, '|'), '1') 

MVP
MVP

Re: How do I script this?

I'm not a fan of calculated dimensions and I wouldn't reference the selections from the list box.  I'd build it as data.  I assume you have a calendar table with the CAL_QTR field in it.  I would add something like CAL_QTR_MONTH with the values you want.  Something like this, say:

pick(CAL_QTR,'MAR','JUN','SEP','DEC') as CAL_QTR_MONTH,

For performance, it's generally better to do this sort of thing in script than in charts.  From a maintenance standpoint, then it's in one place instead of potentially in multiple charts.  And as a general rule, I'd rather put complexity in my script than in my charts, even if it's the same level of complexity and there's no duplication.  I have a hard time putting my finger on why, though, other than the previous two reasons.

Community Browser