Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Specialist II
Specialist II

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!

View solution in original post

2 Replies
jerem1234
Specialist II
Specialist II

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
Author

Perfect!! It works!!

Thank you very much jerem!!!