Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to program a macro in QlikView that let me know when a value in a listbox is greyed out or when its available. For example on the ProDuctAlias listbox I want to know that “Niche” and “Other” are greyed out and that “Argus” is available.
Can anyone help me?
Thank you.
No macro required.
You can use GetFieldSelections(ProductAlias,',',1000) to produce a string of the concatenated possible values.
Then you can use index to see if a particular value is in the string. Something like:
index(GetFieldSelections(ProductAlias,',',1000),'Argus')>0
Hi M Woolf,
Thank you for your answer, I wish I could avoid using macros, however I need to use macros because it needs to do the checking while performing an automated overnight reload .
If you know how to do it using macros please let me know.
Thank you.
Your macro can use GetPossibleValues. Here is an example from the API:
set val=ActiveDocument.Fields("Month").GetPossibleValues
for i=0 to val.Count-1
msgbox(val.Item(i).Text)
next
The suggestions from mwoolf will work. Sometimes could it be easier to calculate the needed data within variables and read them those variables within the macro:
set v = ActiveDocument.Variables("Variable1")
msgbox(v.GetContent.String)
- Marcus
Keep in mind that you can use any valid qv expression in a macro by wrapping it in the Evaluate() function. eg.
ActiveDocument.Evaluate("index(GetFieldSelections(ProductAlias,',',1000),'Argus')>0")
However, you cannot get access to the ActiveDocument during script execution. Is this something you need to determine during the script run?
-Rob