Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

From and To Date

Hello Community,

I' am stuck with an issue. I have created two calendar objects. One of them points to StartDate while the other corresponds to EndDate. Things are working fine... but the client wants current week to be shown in the Calendar objects when they open the application.

Example let us say that today is Monday 08-07-2013 tomorrow will be 9th and so on.. when the end user opens the dashboard he/she should see charts based upon current week and also the main part is that the Calander objects should show the dates corresponding to current week.

If we consider period from 1st July to 5th july, then 'From' calander should show 1st july while the other that is 'To' Calander should show 5th July and these should happen when the dashboard opens

Thanks in advance for your help and suggestions

12 Replies
msheraton
Contributor III

Re: From and To Date

Create two variables

vStartDate =WeekStart(now())

vEndDate =WeekEnd(now())

Settings > Document Properties > Triggers >

OnOpen Action > Add Action > Add > Action Type "Selection" > Action "Select in Field" > OK >

= '>=$(=vStartDate) <=$(=vEndDate)'

See the attached file.

pennetzdorfer
Contributor III

Re: From and To Date

Use Settings > Document Properties > Triggers > Document Event Triggers > OnOpen

Add a new Action "Select in Field"

  • Field = Week ...if you don't have a week-field yet, simply create it in script ... week(yourdatefield)
  • Search String = week(today())

Hope that helps,

Florian

Not applicable

Re: From and To Date

Hi Florian,

Many thanks for your help. Actually my requirement is that I have two calendar objects on the dashboard and user want that when the dashboard is opened, by default the current week Start and end date should be displayed on the Calendar.

You can see from the attchement that there are 2 calendars namely From Date and To Date and this is where we want the current week to be diplayed.

Example for this July month, the current week no. is 28 so the calanders should display 8th on the from Date and 9th on the To Date calanders respectively

Please help

Not applicable

Re: From and To Date

Hi Mark,

I tried your suggestion but it's not working for me.. Actually my requirement is that I have two calendar objects on the dashboard and user want that when the dashboard is opened, by default the current week Start and end date should be displayed on the Calendar.

You can see from the attchement that there are 2 calendars namely From Date and To Date and this is where we want the current week to be diplayed.

Example for this July month, the current week no. is 28 so the calanders should display 8th on the from Date and 9th on the To Date calanders respectively

Please help

pennetzdorfer
Contributor III

Re: From and To Date

I'm not sure if I understand your issue, but if you've got two date fields (StartDate and EndDate) you could try the following:

Use Settings > Document Properties > Triggers > Document Event Triggers > OnOpen

Add two Actions ("Select in Field")

1) Field: StartDate, Search string: =WeekStart(Today())

2) Field: EndDate, Search string: =floor(WeekEnd(Today()))-2

Regards,

Florian

Not applicable

Re: From and To Date

Hi Florian,

I have created two variables vStartWeek and vEndWeek for this purpose

pennetzdorfer
Contributor III

Re: From and To Date

Could you upload a short example qvw that outlines your issue? That would simplify things

Not applicable

Re: From and To Date

Hi Florian,

I'am attaching a sample application for your reference. Here there are two calander objects and the requirement is that we need From calendar to display the starting day of the current week while the other  Calendar(To Date) should show the end date of current week on opening of the dashboard.

Thanks for your help in advance.

pennetzdorfer
Contributor III

Re: From and To Date

There are at least two things you should change:

  1. Don't use "=" in front of variable names in Actions
    2.jpg

  2. Your "OnAnySelect" triggers override the "OnOpen" triggers --> delete or modify them ...1.jpg

I adjusted 1) and 2) and the StartDate works now.

Apart from that: I'm wondering if you really need all triggers/variables ... I guess you could simply target the original field Q_CLOSEDDATEFORMAT for your triggers.

Regards,

Florian

Community Browser