Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Qlikviewers! It's possible that this may require a macro, which I am open to doing (though would prefer not to), but I am wondering how I might go about assigning a variable based on the content of a text box. I would like to have a variable that is equal to whatever text is in a certain text box.
I've attached an example app.
Here's the macro I made:
sub GetTextBoxValue()
set obj1 = ActiveDocument.GetSheetObject("TX02")
set txtbx = obj1.getTextValue
set txtbx = ActiveDocument.Variables("vTextBox")
end sub
Well I figured it out with a macro after a couple hours of trial and error.
See attached.
The macro you need is
sub CommentVars
set dotextbox = ActiveDocument.GetSheetObject( "TX02" )
set dovartext = ActiveDocument.Variables("vTextBox")
for RowIter = 0 to dotextbox.GetRowCount-1
for ColIter =0 to dotextbox.GetColumnCount-1
set cell1 = dotextbox.GetCell(RowIter,ColIter)
dovartext.SetContent cell1.Text, TRUE
next
next
end sub
I should add that the goal here is not to transfer text from one box to another, but to actually get the variable assigned
Well I figured it out with a macro after a couple hours of trial and error.
See attached.
The macro you need is
sub CommentVars
set dotextbox = ActiveDocument.GetSheetObject( "TX02" )
set dovartext = ActiveDocument.Variables("vTextBox")
for RowIter = 0 to dotextbox.GetRowCount-1
for ColIter =0 to dotextbox.GetColumnCount-1
set cell1 = dotextbox.GetCell(RowIter,ColIter)
dovartext.SetContent cell1.Text, TRUE
next
next
end sub
HI Jesse,
why not try using a input box to set the variable value instead? Check out the QV help file for further information
HTH Andy
That's a much more elegant solution. Unfortunately, there's two things preventing this
- The text box has formatting that needs to be displayed in the QVW and transfered to the variable (ie newlines)
- The text box content is different depending on a filter selection