Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Get Value from a table

Hi, I am new to Macro in qlikview. Please help for the below questions.

I set a variable (vVar) to A/B/C.

So object ID will tag to T1/T2/T3.

Question 1: How do I get a value for 555 in macro? I am so confused with all the GetPossibleValues/GetSelectedValues/....

TableABC
T1111222333
T2444555666
T3777888999

Question 2: I want to do a loop where the conditions are:

When the object ID is in the list of Table column, continue;

With the object ID and vVar, I can get the value from the table;

And then there will be some condition formatting parts.

1 Reply
Anonymous
Not applicable
Author

I've figured out some part of my questions.

Question 1: I thought we can't use the formula that used in expression, then I realised that we can use with Evaluate().

ActiveDocument.Evaluate("FieldValue('B',FieldIndex('Table','T2'))")  -> this will get 555


Question 2: I'm still half way to finish the script. Please check how should I amend my script.


Sub test()

Set mysheet = ActiveDocument.ActiveSheet

Set vVar = ActiveDocument.GetVariable("vVar")

Tlist = ActiveDocument.GetField("Table")

no = mysheet.NoOfSheetObjects

For i=0 to no - 1

    id = Replace(mysheet.SheetObjects(i).GetObjectID,"Document\","")

    check = ActiveDocument.Evaluate("Sum(If(Tlist = id,1,0))")

          IF check = 1 Then

              A = ActiveDocument.Evaluate("FieldValue(vVar,FieldIndex('Table',id))") -> A didn't come out as a value

              .....condtional formatting part....

          End If

Next

End Sub

Thanks.