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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
danielact
Partner - Creator III
Partner - Creator III

Changing values in an InputField

I have an InputField called Input1. The initial values load off of an Excel file. I'd like to link a button to a macro that will change all the values to zero. Is there a way to code that in a macro? I already know how to make them revert to the original values, but how can I force a specific value on them?

3 Replies
Not applicable

Maybe I don't fully understand your goal, but it sounds like it would be easier to use a trigger to set the variable to zero on opening. Have you tried that?

jeffmartins
Partner - Creator II
Partner - Creator II

Hi danielact,

You can use the SetInputFieldCell or SetInputFieldValue to change the inputfield values.

example:

set fld = ActiveDocument.Fields("Budget")

fld.SetInputFieldValue 0, "999"

set obj = ActiveDocument.GetSheetObject("TB01")

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

See the Api Guide for more details. Hope this helps you.

Regards

Not applicable

hi

try this in macro,

document-->trigger-->on post reload

sub resetinput

dim x(1)

x(0) = 0

set fld = ActiveDocument.Fields("newprice")

fld.ResetInputFieldValues 0, x

end sub