Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to know when a fild is greyed out using macro

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.

Untitled.png

Can anyone help me?

Thank you.

5 Replies
m_woolf
Master II
Master II

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

Not applicable
Author

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.

m_woolf
Master II
Master II

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

marcus_sommer

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

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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