Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Select a range of data from a field

Hi Experts,

Simply question for you all 🙂

I am trying to make a"from-till"selection on a database field.
For example: I want all product with [ProductID] from 20000 until 30000.

What I did sofar:

I made 2 variable: vProductID_first and vProductID_Max and made 2 inputboxes to fill in the numbers.
But how do i get vProductID_first to be the first of the range and vProductID_Max to be the last [ProductID].
I have been trying to make a button with a macro function to this but I don't seem to find the right macro code


Or is there an other way maybe?


1 Solution

Accepted Solutions
Not applicable
Author

Hi,

If you are looking for a macro you can use this:-

sub selection

ActiveDocument.ClearAll false
First= ActiveDocument.Variables("vProductID_first").GetContent.String
Last= ActiveDocument.Variables("vProductID_Max").GetContent.String
mySelect= ">" & First & " <" & Last
ActiveDocument.Fields("ProductID").Select mySelect

end sub

Thanks & Best Regards,

Kuldeep Tak

View solution in original post

12 Replies
Not applicable
Author

Do you want to apply your filter during the reload or done by the user ?

Rgds,

Sébastien

Not applicable
Author

Hi, I find the way for your problem, but is don't still 100%

I use the trigger in button -> ToggleSelection.

The function Clear All in the trigger is not work. When the selection is clear manually the filter is OK.

Anonymous
Not applicable
Author

Thanks Eduardo.

That is what I am looking for.
I have no idea why the "Clear" is not working, I am going to work on that.

Not applicable
Author

Hi,

If you are looking for a macro you can use this:-

sub selection

ActiveDocument.ClearAll false
First= ActiveDocument.Variables("vProductID_first").GetContent.String
Last= ActiveDocument.Variables("vProductID_Max").GetContent.String
mySelect= ">" & First & " <" & Last
ActiveDocument.Fields("ProductID").Select mySelect

end sub

Thanks & Best Regards,

Kuldeep Tak

Anonymous
Not applicable
Author

Thanks mister Kuldeep Tak!,

That is exacly what I need! Smile

Yes

Anonymous
Not applicable
Author

One more thing....

This works perfect with number, but how do I need to change this with names?
If I use this on alphabetic field with it doesn't work

Anonymous
Not applicable
Author

Or even mixed numbers and letters ...

Anonymous
Not applicable
Author

Anybody?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If you are searching text, enclose the search values in single quotes:

mySelect= ">'" & First & "' <'" & Last & "'"

Also, if you are uisng V9, I recommend you use the Action "select in field" instead of a macro.

-Rob