Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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/....
Table | A | B | C |
---|---|---|---|
T1 | 111 | 222 | 333 |
T2 | 444 | 555 | 666 |
T3 | 777 | 888 | 999 |
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.
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.