Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Script expression for current month

Please,

How do I wirte in the edit script, an expression for the current month. So that I can create a button object for a selection of current month only.

Please maximum help is needed

Dan

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

if you want you can try it with an other idea.

1. Load an additional Field with


Load
...
inmonth(<DateField>,Now()) as ActualMonth
...
FROM...


2a. Create the Button, and as Action select "Select in Field"

2b. as Field select "ActualMonth" or whatever you have named that field

2c. as Search String take "1" (without the quotes)

Then it should select only the values in the actual month.

Have fun with QlikView

Alex:)

View solution in original post

11 Replies
Miguel_Angel_Baeyens

Hello Dan,

You can always use something like:

Num(Month(Today()))


To get the current month number.

Not applicable
Author

Thanks Miguel,

Then how do I create a button object to select only the current month. Your help is appreciated

Miguel_Angel_Baeyens

If you are using version 9, just create a new button object, go to actions -> add -> "Type" = selection and on the right list, select "Select in field". You will be asked for the field name you want to search and the Search String, which is

=Num(Month(Today()))
(note the "=" before the expression).

And that's it!

Not applicable
Author

Sorry I'm disturbing you so much. What do I type in the "Field" in the "Actions" tab of the button properties?

Also, is there any need for anything in the enable conditions?

Not applicable
Author

Hi,

if you want you can try it with an other idea.

1. Load an additional Field with


Load
...
inmonth(<DateField>,Now()) as ActualMonth
...
FROM...


2a. Create the Button, and as Action select "Select in Field"

2b. as Field select "ActualMonth" or whatever you have named that field

2c. as Search String take "1" (without the quotes)

Then it should select only the values in the actual month.

Have fun with QlikView

Alex:)

Not applicable
Author

my suggestion is :

RUN MACRO it will solve all problems.

In macro is where u will use vbscript coding.

Hope u will b fine. Wink

Miguel_Angel_Baeyens


dan wrote:Sorry I'm disturbing you so much. What do I type in the "Field" in the "Actions" tab of the button properties?


Your Month Name Field or Date Name Field.


dan wrote:Also, is there any need for anything in the enable conditions?


As far as I understand you just want to make a button to make selection equal to current month. So no, it doesn't. Well, depending on your chart, but that would be a different question.

Not applicable
Author

Hi I tried the inmonth thing, but it says, Error: inmonth takes 3-4 parameters.

what do i do?

Not applicable
Author

Sorry it was

inmonth(<Datefield>,now(),0) (see help for more information)

Alex:)