Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

copy value in a variable

Hello,
I need to copy the actual value of one field in a variable.

load * inline [
salesman , qty
paul , 10
peter , 50
Alan , 30

];

I put this values in a table

Now, if I select one Item in a table I would to copy the value of Salesman field
I selected in the variable . In this way I could to use the variable also ina a SQL
scrpt.
How to do this?

Thabk you .
Regards,

-
slash

15 Replies
Not applicable
Author

HI Slash,

Heres the updated one. This only select one salesman and has verification if no salesman is selected.

I use this code in OnSelect Action of Salesman.


=SubField(GetFieldSelections(Field), ',', 1)


Hope this solves your problem

Regards,

Nadsky

Not applicable
Author

Just one thing:

you have insert this code in API:

SET selectedValue = ActiveDocument.fields("salesman"

).GetSelectedValues

But I need the value comes from a TEXT BOX andnot from a Salesman Field..

Many Thanks for you BEST support

Regards

Slash





Not applicable
Author

Hi Nadsky,

the applicatio wascorrect but I need to capture a value from a text box.

I select a salesman the valueis copued in a text object and I put from a TBLE BOX to a variable and not from a field ?

Please, could to update the code?

Thnks so much

Regards,

-------------

Slash

Not applicable
Author

Hi Slash,

Please use this macro code:


sub mySub

Set myText = ActiveDocument.GetSheetObject("TX01")
Set v = ActiveDocument.Variables("new")

if myText.GetText = "-" then
msgbox("Please select a value")
else
v.SetContent myText.GetText, true
end if
end sub


The variable now get its value from the value of the textbox.

Regards,

Nadsky

Not applicable
Author

Are you sure of this line::

if myText.GetText = "-" then

it doesn't work

Not applicable
Author

Yup.. if you don't select any customer from the list box the text value of Text Object is a dash (-)

Please see attached file. It works !