Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
alerse
Contributor III
Contributor III

field lookup from variable in macro

Hi

How can I get the value out of my data in a macro?

currently my code looks like this


set var = ActiveDocument.GetSheetObject(objID)
prop = var.GetProperties
prop.Layout.Text.v = <I need Target here>
var.SetProperties prop


I have a table that have a table that looks like this:

Level1 Target

L1Text 34.3

L1Text2 22.1

The objID will for example be L1Text and I want to change

prop.Layout.Text.v = <I need Target here>


to

prop.Layout.Text.v = (if objID = Level1(in the table), display Target)


Any ideas?

Thank you!!

Labels (1)
1 Reply
rwunderlich
MVP
MVP

It's usually easiest to do this (without a macro) in the chart with an expression like:

fieldvalue('Target',fieldindex('Level1', 'L1Text'))

A warning -- fieldindex() was not working on the QV Server on some release. So test on the server.

If you have futher questions, can you upload an example qvw so I can be sure I understand?

-Rob