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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
manoranjan_d
Specialist
Specialist

value in macro

Hi,

How to get the "value of the field from table box" in the  macro coding.

4 Replies
marcus_sommer

Have a look on this example from APIGuide.qvw:

set TableBox = ActiveDocument.GetSheetObject( "TB01" )

CellRect = ActiveDocument.GetApplication().GetEmptyRect()

CellRect.Top = 0

CellRect.Left = 0

CellRect.Width = TableBox.GetColumnCount

CellRect.Height = TableBox.GetRowCount

set CellMatrix = TableBox.GetCells( CellRect )

for RowIter=CellRect.Top to CellRect.Height-1

    for ColIter=CellRect.Left to CellRect.Width-1

        msgbox(CellMatrix(RowIter)(ColIter).Text)

    next

next

- Marcus

manoranjan_d
Specialist
Specialist
Author

MARCUS

example if we have client as field in the table box and and it contains 10 different values of different clientname. then how you get the selected client in the macro.

client

xxx1

xxx2

xxx3

xxxx4

.

.

.

xxx10


suppose if i click the xxx10 and the same value has to be  passed in the macro what is the coding?

Anonymous
Not applicable

//create a variable in UI like :

vClient=GetFieldSelections(Client)

//in macro

DIM vClient1


vClient1=ActiveDocument.GetVariable("vClient").GetContent.String

now your vClient1 is having selected client name (xxx10 )

marcus_sommer

Maybe it's easier to run directly through a field instead of using a tablebox:

set val=ActiveDocument.Fields("clientname").GetPossibleValues

for i=0 to val.Count-1

    msgbox(val.Item(i).Text)

next

- Marcus