Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Assign selection of field from multibox to field in input box

How to assign Product_Code field in multibox to vVar Variable. Can anyone help me for writing the code for the same.

Thanks and Regards

V Joseph Raj

1 Solution

Accepted Solutions
MVP
MVP

Re: Assign selection of field from multibox to field in input box

Joe,

what are you trying to achieve with the Macro? If you just want to have variable vVar assigned the current selections in field Product_Code, it's easier to just define the Variable vVar in variable overview like

=only(Product_Code)

if you select not more than one code at a time, or

=GetFieldSelections( Product_Code )

To choose the right function and syntax, it is best to know what you want to do with this variable, e.g. if you want it to pass into another function.

Regards,

Stefan

4 Replies
MVP
MVP

Assign selection of field from multibox to field in input box

Joseph,

so you just want to display the selected Product_Code? Then I would use a formatted text box instead.

You can show the selected Product_Code: In constraints of your input box, check listed values and enter

=only(Product_Code)

Use no list or predefined values in dropdown list option, but the problem arise if the user modify this value (well, after all, it's an input box). The shown value will not refresh accordingly.

But since I don't know what you want to achieve, just give it a try.

Hope this helps,

Stefan

Not applicable

Re: Assign selection of field from multibox to field in input box

Hello Stefan,

I tried the following marcro to do but I am getting a error

How to assign the Product_Code(in a Multibox) to vVAr variable(in an input box).

Sub Selector

Let prodcode=ActiveDocument.Fields("Product_Code").Select

ActiveDocument.Variables("vVar").GetContent.String=prodcode

End Sub

I have also tried

Sub Selector

ActiveDocument.Fields("Product_Code").Select prodcode

ActiveDocument.Variables("vVar").SetContent prodcode,true

End Sub

it is not working

Can you assist me.

Regards

Joe

MVP
MVP

Re: Assign selection of field from multibox to field in input box

Joe,

what are you trying to achieve with the Macro? If you just want to have variable vVar assigned the current selections in field Product_Code, it's easier to just define the Variable vVar in variable overview like

=only(Product_Code)

if you select not more than one code at a time, or

=GetFieldSelections( Product_Code )

To choose the right function and syntax, it is best to know what you want to do with this variable, e.g. if you want it to pass into another function.

Regards,

Stefan

Not applicable

Assign selection of field from multibox to field in input box

Dear Stefan,

Thanks a lot, your answers satisfied with my requirements.

Regards

Joe

Community Browser