Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

dreamer78692
Contributor

Selection based on Input

Hi,

I have a macro:

sub selectYear

          msg = inputbox("Please Enter Year: ")

          ActiveDocument.Fields("ThemeDate").Select "*/*/msg*"

end sub

when the user types "2011" all entries for the year 2011 should show, but it does not.

But when I have :

sub selectYear

          msg = inputbox("Please Enter Year: ")

          ActiveDocument.Fields("ThemeDate").Select "*/*/2011*"

end sub

the macro works,

I know it has to do with the input, do I have to trim(take away trailing whitespace) it or something like that.

Kind Regards

Razak

1 Solution

Accepted Solutions

Re: Selection based on Input

Hi,

     Try with his

sub selectYear

          msg = inputbox("Please Enter Year: ")

          ActiveDocument.Fields("ThemeDate").Select "*/*/" & msg & "*"

end sub

If you use variable name inside the double quotes then it take that as string(it looks for */*/msg* not */*/2011*).

Hope it helps

Celambarasan

2 Replies

Re: Selection based on Input

Hi,

     Try with his

sub selectYear

          msg = inputbox("Please Enter Year: ")

          ActiveDocument.Fields("ThemeDate").Select "*/*/" & msg & "*"

end sub

If you use variable name inside the double quotes then it take that as string(it looks for */*/msg* not */*/2011*).

Hope it helps

Celambarasan

dreamer78692
Contributor

Selection based on Input

Works Perfectly!!!

Thanks

Community Browser