Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Example - say I have a field which has the following values;
sunshine
sunbeam
sunny
sunscreen
nightime
daytime
I'd like to allow a user to enter a search term via an input box e.g. sun* and have another input box where they can specifically exclude a value e.g. suns* so the resulting selected list would be sunbeam, sunny.
I'm using triggers to do it but it's not working for some reason. It worked ok until I tried to add the NOT code.
Any ideas?
Thanks
See attached example.
Edit: there are two triggers, one for each variable. When the value of one of the variables changes the trigger for that variable fires and executes a Select in Field action. You can see the parameters for the action by opening the document properties window, go to the Triggers tab, select a variable and click on the Edit Action(s)... button below the OnInput label. The search string definition is an expression that creates list of values (just like in the text box) in the correct search string format.
Let's say you have two variables in your inputbox: vInclude and vExclude. Then you can use this macro (or it's equivalent in trigger commands):
SUB FilterColumn
ActiveDocument.Fields("urlPhoto").Select getVariable("vInclude")
ActiveDocument.Fields("urlPhoto").ToggleSelect getVariable("vExclude")
END SUB
FUNCTION getVariable(varName)
set v = ActiveDocument.Variables(varName)
getVariable = v.GetContent.String
END FUNCTION
See attached example.
Edit: there are two triggers, one for each variable. When the value of one of the variables changes the trigger for that variable fires and executes a Select in Field action. You can see the parameters for the action by opening the document properties window, go to the Triggers tab, select a variable and click on the Edit Action(s)... button below the OnInput label. The search string definition is an expression that creates list of values (just like in the text box) in the correct search string format.
Thank you Gysbert that works a treat! As I'm fairly new to Qlikview, are you able to explain in some words what the trigger is doing?
Hi,
I've added another input field so that a user can choose whether to select ANY or ALL search terms and have modified the triggers but it doesn't seem to be working as I'd like it to. It only seems to work if the user presses enter after the third input box but I'd like to allow them just to change the first input box and the correct selection be made. I've attached my example document. If you add the text ,*day* to the first input box it seems to work the first time but after that it doesn't work correctly if only that input box is changed (I hope this is making sense!).
Do you have any ideas what I'm doing wrong?
Many thanks for any assistance as I've been staring at this for some hours now!!
Elaine