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: 
lukegilligan_scch
Contributor
Contributor

Populating Input Table full of Macro with Values from Front End Table

I'm trying to work out how to populate an Input Table with values from a Table using a macro.

Below is the table and the input table that I wish to populate

lbZNOn.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I have seen code that lets me select the cell based on row/column numbers, but I am trying to work out how to do it via an IF statement, eg:

Sub Condition-Ext Wall Paint BCK

set table = ActiveDocument.GetSheetObject( "TB_YearNew" )
CellRect = ActiveDocument.GetApplication().GetEmptyRect()
CellRect.Width = table.GetColumnCount
CellRect.Height = table.GetRowCount
set CellMatrix = table.GetCells(CellRect)

r = Activedocument.variables("r").Getcontent.String
c = Activedocument.variables("c").Getcontent.String

set cell = CellMatrix.Item(r).Item(c-1)

Activedocument.variables("Mod-Condition-Ext Wall Paint BCK").SetContent cell.text,1

End Sub

I need to work out how to replace the orange text with an IF statement that does the following

IF([Component] = 'Condition-Ext Wall Paint BCK', THEN COPY THE VALUE IN THE CELL TO THE RIGHT)

Any help would be much appreciated.

Labels (1)
2 Replies
lukegilligan_scch
Contributor
Contributor
Author

Any suggestions at all?

marcus_sommer

If you not want to set fixed variable-values else depending ones you will need to pull all needed values into the macro. All relevant values must be on the same level and then you could apply an if-then-else.

Personally I don't think that this macro-approach is the easiest method. Because of your description it looked that you want to read a table-box which means this data exists already within the datamodel and aren't calculated within the Ui and therefore the variables could be created and set within the script.

Also thinkable is to use an expression within the input-box to fill the variables directly with the wanted values. An input-box could also provide scroll- and drop-down listings for the variables and they could be also calculated.

- Marcus