Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Display years dynamically

Hi Kaushik,

In my file i need to display last years in a single to variable based on one field, it should be dynamical changes.

In below to statement  is a field "DistinctCaptureDate", based on this field last 7 years should display.

Year(max(DistinctCaptureDate))-1  to  Year(max(DistinctCaptureDate))-7  should store in a single variable.

How can i work on this.

Pls check the attached QVW file.

Regards

Venkat

10 Replies
Miguel_Angel_Baeyens

Hello Venkat,

Don't know if this makes many sense, but you can try with

=Concat(ValueLoop(Max(TOTAL Year(DistinctCaptureDate)) -7, Max(TOTAL Year(DistinctCaptureDate)) -1, 1), ',')

To get all the values within the range.

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

Not applicable
Author

Hi Miguel,

Thanks for your reply.

I tried your code in variable value.  Then it is showing like this 2004,2005,2006,2007,2008,2009,2010.

But it should show like below (in a vertical order without having commas).

     2004

     2005

     2006

     2007

     2008

     2009

     2010.

Regards

venkat

Not applicable
Author

Concat(ValueLoop(Max(TOTAL Year(DistinctCaptureDate)) -7, Max(TOTAL Year(DistinctCaptureDate)) -1, 1), chr(13))

swuehl
MVP
MVP

Hi,

see attached sample, mostly the already proposed way.

Regards,

Stefan

Not applicable
Author

Hi swuehl,

I cannot open your file, bcoz my Qlikview is personalized version.

Pls send the steps to implement in my QVW file.

Regards

venkat

swuehl
MVP
MVP

Hi venkat,

set Variable vNYear to

ValueLoop(year(vMaxCapDate)-7,year(vMaxCapDate)-1, 1)

(no equal sign)

Set field expression to

=$(vNYear)

Regards,

Stefan

Not applicable
Author

Hi Swuehl,

Thanks for reply.

It is showing years in listbox but one problem.

I tried your steps BUT when i select  a particular year in listbox, it is not selecting.

Why ?

Regards

Venkat

swuehl
MVP
MVP

Hi,

well, we have just created a list of values, no connection to other data tables. So you can't use this box for selection, just for display.

As I understand, the task is to generate just the list of the years, but there is no requirement for selection.

If there is a requirement, you might need to add a calendar to your data model (and then limit the list box to the given years, but this is somewhat more then just two lines).

[Besides, there is no data for past years ]

Regards,

Stefan

Not applicable
Author

Hi Swuehl,

In the attached QVW file, there is a field "DistinctCaptureDate". Based on that last 7 years should display in the listbox.

When i select a particular date from "DistinctCaptureDate" field that year should be highleted in the "DistinctCaptureyear" listbox.

How can i work on this. Pls see the attached QVW file.

Regards

Venkat