Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
Not applicable

Add another value to the object returned by the getSelectedValues function

Hi,

excuse me for my english.

I want to add another value to the object returned by the getSelectedValues function and i don't know how i can do it.

This is my code:

sub ADDNULLSELECTION()

  set doc = ActiveDocument

  set selectedValues = doc.fields("Project_Id").getSelectedValues

    // Here should be the code that adds another value to the "selectedValues" variable but i have not found the kind of object that returns the getSelectedValues function and i don't know how i  can do it.

   

  doc.fields("Project_Id").SelectValues(SelectedValues)

end sub

¿Can someone help me please?

Thanks.

1 Solution

Accepted Solutions
jerem1234
Valued Contributor II

Re: Add another value to the object returned by the getSelectedValues function

Try this set of code:

sub ADDNULLSELECTION()

  set doc = ActiveDocument

  set selectedValues = doc.fields("Project_Id").getSelectedValues

  selectedValues.add

  selectedValues(selectedValues.count-1).Text= "YourValueHere"

  selectedValues(selectedValues.count-1).IsNumeric = false

  doc.fields("Project_Id").SelectValues selectedValues

 

end sub

Hope this helps!

2 Replies
jerem1234
Valued Contributor II

Re: Add another value to the object returned by the getSelectedValues function

Try this set of code:

sub ADDNULLSELECTION()

  set doc = ActiveDocument

  set selectedValues = doc.fields("Project_Id").getSelectedValues

  selectedValues.add

  selectedValues(selectedValues.count-1).Text= "YourValueHere"

  selectedValues(selectedValues.count-1).IsNumeric = false

  doc.fields("Project_Id").SelectValues selectedValues

 

end sub

Hope this helps!

Not applicable

Re: Add another value to the object returned by the getSelectedValues function

Perfect!! It works!!

Thank you very much jerem!!!