Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get search string assigned to a field?

Hi,

In a VbScript macro, I'm setting a search string to a field as below:

ActiveDocument.Fields("Sales").Select ">1500"

Now I have a use case where I would like to retrieve this search string. So something like:

ActiveDocument.Fields("Sales").GetCurrentSearchString

Unfortunately, I couldn't find such method in the API.

Am I simply missing it or is there another way to achieve this?

I'm thinking to use QlikView variables as another way to do it: storing the search string into a variable and then do

ActiveDocument.Fields("Sales").Select variable_value

Thanks for your help

4 Replies
MayilVahanan

Hi

Try like this

Sub fieldselection

set v = ActiveDocument.Variables("vDay")

ActiveDocument.Fields("Day").Select v.GetContent.String

end sub

edit:

Sub fieldselection

set v = ActiveDocument.GetVariable("vDay")

v.SetContent "123",true                                                                      'To set the value for the variable

ActiveDocument.Fields("Day").Select v.GetContent.String                     'To assign the value to select   

end sub

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thanks Mayil

So I guess there is no "builtin" method from the API that I can use to do this?

I'll use what you propose if that's the case

MayilVahanan

Hi

There is no GetCurrentSearchString option in macro as per my knowledge..

But by the above method, you can get the search string.. by using the variable in input box or assign the value for the variable in macro itself..

If you don'e like to go for macro means, you can go through button itself..

Action ->Select in field

Field: Sales

Search String:  '>='&1500

Hope it  helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Actually, I just found out that this works in a macro!

currentSearchString = ActiveDocument.Evaluate("GetFieldSelections(Sales)")