Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Can't write a straight table cell via macro

Hi to all,

I've a problem with macros....

I've wrote vb subroutine to set some table's cell to a specific value (computed in the macro).

My code is simply:

msgbox(table.GetCell(1,2).text)

table.GetCell(1,2).text "4"

msgbox







(table.GetCell(1,2).text)

The first msgbox shows me 0, the correct cell value, after I set the cell to 4, but the next msgbox shows me 0 too,,,not 4 as I hope...

How can I correctly set the cell values for a Straight table?

Thank you!

Matteo



1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Please see attached example.

I moved the inputfield to the expressions and added an Inputsum() function around it to properly aggregate the fields associated with the dimension value. It should work now.

View solution in original post

9 Replies
Not applicable
Author

do you not want it to be


table.SetCell(1,2).text "4"


Anonymous
Not applicable
Author

As pointed out you can't use GetCell to set a value. There is no SetCell api that I'm aware of and the only way I can see you performing this operation is by using an input field and the SetInputFieldCell member.

Example from API Guide:

set obj = ActiveDocument.GetSheetObject("CH01")

obj.SetInputFieldCell 1,1,"999" 'set value in 2nd row, 2nd column to 999

Anonymous
Not applicable
Author

It seem doesn't work....

I've tried to define a straight table, two dimension:

- A "real dimension"

- A "input field" dimension

I've set up a macro with the scratch of code you suggested me (I've also checked it in the reference API document), but il fault, when the script reaches the "SetInputFieldCell" instruction it brakes the excecuttion without any error message...it simply showes the macro editor window..

I don't know how to solve this problem...

Thank you for yuor help!

Anonymous
Not applicable
Author

Do you have an example document to attach?

Anonymous
Not applicable
Author

I've setted up an example with a simple inline table with a dimension and an imput field.

When you press the button macro the execution creashes on the setInputFieldCell.

Thank you for your help.

Anonymous
Not applicable
Author

Please see attached example.

I moved the inputfield to the expressions and added an Inputsum() function around it to properly aggregate the fields associated with the dimension value. It should work now.

Anonymous
Not applicable
Author

Thak you for your help! Now all works fine! Smile

Not applicable
Author

Hi all, Im using a macro to compare two tables that are not related each other, and I want to add in the next column something saying "equal"  or "not equal", I tried to use your code to change the value of the cell but it didnt work. How could I do it?

Thanks in advance.

Not applicable
Author

I got something using your code, the problem is that it changes all the values in the rows for the column of "inputsum(prova)"

Help please!

ERP project name=InputSum(PROVA)
COOPVT:EMEA:NIK:SUP 0
PERT:EMEA:NIK:ARM 0
PVT:EMEA:NIK:CO 0
AL:EMEA:NIK:IS 0

Thanks guys.