Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

function getPossibleValues add values

Hi,

I have found a function that returned the possible values (getPossibleValues). Is possible add more values to this object and then call to a function that set the values again? (setPossibleValues or similar)

Thanks

4 Replies
sundarakumar
Specialist II
Specialist II

Can u explain what kind of additions or what conditions u would use with the getpossiblevalues to create a setpossiblevalues bec i think what u look for can be done with triggers.

-Sundar

Gysbert_Wassenaar

There's no setpossiblevalues function. There are actions you can add to for example buttons and field triggers. It sounds like you want to use the Select in Field action. And use as search string something like:

='(' & concat(distinct chr(34) & MyFieldHere & chr(34), '|') & '|"Some Extra Value 1"|"Some Extra Value 2"|...etc )'


talk is cheap, supply exceeds demand
Not applicable
Author

this is my code but i think it's not possible what i want to do....

sub SELECT_PRODUCT_AUX()

  set qvDoc = ActiveDocument

  rem //Actualizamos el producto auxiliar

  set productField = qvDoc.GetField("Producto_Id")

    set selectedFields = productField.getSelectedValues()

  

    set productAuxField = qvDoc.GetField("Producto_Id2")

    productAuxField.selectValues selectedFields

  

    rem //Añadimos los posibles valores de los almacenes de inventario a los ya almacenes posibles por el resto

    set locationField = qvDoc.getField("Almacen_Id")

    set possibleFields = locationField.GetPossibleValues()

  

    set locationAuxField = qvDoc.getField("Almacen_Id2")

    set possibleFieldsAux = locationAuxField.GetPossibleValues()

  rem // número de posibles elementos iniciales

  int numElem = selectedFields.Count

  rem //Añadimos los nuevos elementos 

    for i=1 to possibleFieldsAux.Count

    possibleFields.add()

  next

  int j=1

  for i=numElem to numElem + possibleFieldsAux.Count-1

  possibleFields(i).Text=possibleFieldsAux(j).Text

  possibleFields(i).IsNumeric = false

  j=j+1

  next

  rem here It should be the code that adds other possible value to the Producto_Id field but i don't know i

end sub

Not applicable
Author

Thanks Gysbert,

i was trying to do it, but i think it's not possible:

sub SELECT_PRODUCT_AUX()

  set qvDoc = ActiveDocument

  rem //Actualizamos el producto auxiliar

  set productField = qvDoc.GetField("Producto_Id")

    set selectedFields = productField.getSelectedValues()

 

    set productAuxField = qvDoc.GetField("Producto_Id2")

    productAuxField.selectValues selectedFields

 

    rem //Añadimos los posibles valores de los almacenes de inventario a los ya almacenes posibles por el resto

    set locationField = qvDoc.getField("Almacen_Id")

    set possibleFields = locationField.GetPossibleValues()

 

    set locationAuxField = qvDoc.getField("Almacen_Id2")

    set possibleFieldsAux = locationAuxField.GetPossibleValues()

  rem // número de posibles elementos iniciales

  int numElem = selectedFields.Count

  rem //Añadimos los nuevos elementos

    for i=1 to possibleFieldsAux.Count

    possibleFields.add()

  next

  int j=1

  for i=numElem to numElem + possibleFieldsAux.Count-1

  possibleFields(i).Text=possibleFieldsAux(j).Text

  possibleFields(i).IsNumeric = false

  j=j+1

  next

  rem here It should be the code that adds other possible value to the Producto_Id field but i don't know the way to do it

end sub

thanks a lot