Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

wonkymeister
Contributor

Macro Help - Set a Cell Value with Variable

Hi,

i need to set a cell in a straight table with a value from a variable.

but my code isn't setting the cell with the value from the variable, instead its deleting the value from the variable. i think its getting the cell value (null) and setting the variable to it (null)

rather than doing what i want which is to get the value from the variable and setting it to the cell!

Sub GetTotal

set ch = ActiveDocument.GetSheetObject("CH01").GetCell(1,5)  'empty cell to populate

set vVar = ActiveDocument.Variables("vMyVariable") 'my variable that stores the value

vVar.SetContent ch.text, false

End Sub

Help!

Cheers.

1 Solution

Accepted Solutions

Re: Macro Help - Set a Cell Value with Variable

Qlikview is not a spreadsheet application like MS-Excel. It is not possible to set the value of a single cell. The values in the cells are calculated based on the dimensions and expressions of the chart (and the selections made by the user).


talk is cheap, supply exceeds demand
3 Replies

Re: Macro Help - Set a Cell Value with Variable

Qlikview is not a spreadsheet application like MS-Excel. It is not possible to set the value of a single cell. The values in the cells are calculated based on the dimensions and expressions of the chart (and the selections made by the user).


talk is cheap, supply exceeds demand
wonkymeister
Contributor

Re: Macro Help - Set a Cell Value with Variable

the API provides a method called SetInputFieldCell which only works with a straight table box:

set obj = ActiveDocument.GetSheetObject("CH68")
obj.SetInputFieldCell 0,3,"999" 'set value in 2nd row, 2nd column to 999

Why wouldn't this work?

wonkymeister
Contributor

Re: Macro Help - Set a Cell Value with Variable

Thanks Gysbert - i get it now.

Community Browser