Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I want to allow the users to enter some search strings into an Input Box, then click a button to find and select items in a list box that match their search values, as if they had just clicked the search button on the list box caption bar, entered their search and pressed enter to select the matching items.
How can I do this? Do I need to write a macro?
Thanks for your help.
James
One other question: when you post up replies I see sometimes you refer to attachments, but I can't see where you access them from, can anyone tell me?
James,
1. It easy to implement with a macro:
sub SelectVar
ActiveDocument.Fields("Field").Clear
set vSel = ActiveDocument.Variables("vSelect")
ActiveDocument.Fields("Field").Select vSel.GetContent.String
end sub
2. To send attachment, use "Reply" on the right, not the "Quick Reply", and see tab "Options"
James,
1. It easy to implement with a macro:
sub SelectVar
ActiveDocument.Fields("Field").Clear
set vSel = ActiveDocument.Variables("vSelect")
ActiveDocument.Fields("Field").Select vSel.GetContent.String
end sub
2. To send attachment, use "Reply" on the right, not the "Quick Reply", and see tab "Options"
Yes, that can be accomplished using a macro. I think there should be a thread on the first page about filtering based on a variable. I didn't follow the thread, but that may be a good thing to check out.
If you open the APIGuide.qvw that should have been installed with QlikView, you can find quite a bit of information on the object model.
For your purposes, you'd need to access the variable and then set a Selection based on the entered value.
As for attachments, if another user has attached a file, there will be a link below their name. To add an attachment to your post, use the Add/Update Attachments button on the Options tab when replying to or composing a new message.
Hi,
great Macro. It is possible to do this with not only one search string? I want to insert a lot of ID's in the input field and want to select all matching ID's in the other field with a macro.
Thanks,
jup
this can also be done, but it require a bit more code 🙂
First, make sure that the values in the inputbox is comma separated. Then write a macro that split() the string and then use toggleselect() to select each of the values in the array to your object. Split() is a built in VBSCript function (use google) and toggleselect is a Qlikview api function (use apiguide.qvw).
EDIT:
Im kind today so I'll share the code;
sub MultipleSelect
set doc = ActiveDocument
set obj = doc.Fields("TransLineID")
set var = doc.Variables("vSelectArray")
varArray = var.GetContent.String
varValue = split(varArray,",")
obj.Clear
for i=lbound(varValue) to ubound(varValue)
obj.ToggleSelect varValue(i)
next
end sub
Thanks man!
This is something that I have been searching for a while! I had a problem at first but then realized that I needed to trim the varValue. I also wanted to include the wildcards in the search.
My redefined code looks like this:
for i=lbound(varValue) to ubound(varValue)
SearchString="*"& trim(varValue(i)) & "*"
ActiveDocument.Fields("InstallationName").ToggleSelect SearchString
next
Thanks again. It works great!
But I have another question now:
I switched from using comma seperated IDs to line breaked ID's with this line:
varValue = split(varArray,CHR(10))
Now if I copy the IDs with a line break, for example:
320935511
606338689
-1211816315
-681787372
76711
76714
76778
1747704
the sort of the selected fields after running the macro isn't the same I posted in the input field. I haven't checked any sort option for this field.
1. Is it possible to sort the selected ID's like the sort of the ID's from the input field?
2. Is it possible to use input fields with multiple lines? (QlikView 8.5)
Thanks jup
Thanks again. It works great!
But I have another question now:
I switched from using comma seperated IDs to line breaked ID's with this line:
varValue = split(varArray,CHR(10))
Now if I copy the IDs with a line break, for example:
320935511
606338689
-1211816315
-681787372
76711
76714
76778
1747704
the sort of the selected fields after running the macro isn't the same I posted in the input field. I haven't checked any sort option for this field.
1. Is it possible to sort the selected ID's like the sort of the ID's from the input field?
2. Is it possible to use input fields with multiple lines? (QlikView 8.5)
Thanks jup
very useful post
Hi blaise,
could you help me with my question below?
Thanks,
jup