0

On my process, I have a variable that is an array of objects similar to the following:

"llista-finques" : [
{
"FIN_ID": "H10",
"FIN_NOMBRE": "PLUTO VIVIENDAS",
"FIN_PROPIETARIO": "H10",
"FIN_LINIA_NEGOCIO": "Horizontal"
},
{
"FIN_ID": "H11",
"FIN_NOMBRE": "PLUTO PARKING",
"FIN_PROPIETARIO": "H11",
"FIN_LINIA_NEGOCIO": "Horizontal"
},
{
"FIN_ID": "H12",
"FIN_NOMBRE": "PINTO VIVENDES",
"FIN_PROPIETARIO": "H12",
"FIN_LINIA_NEGOCIO": "Horizontal"
},
{
"FIN_ID": "H16",
"FIN_NOMBRE": "ZURUBANDO",
"FIN_PROPIETARIO": "H16",
"FIN_LINIA_NEGOCIO": "Horizontal"
} ......

I am trying to create a Calculated Propery in one of my forms that needs to create a subset of this array filtering by object property. In order to do so, I was hoping to use the following javascript for the calculated field:

return this.llista-finques.filter(finca => {return finca.FIN_PROPIETARIO === this.Id_client});

For some reason this code produces no result, and after many tests, I have arrived at the conclussion that the variable "this.llista-finques" is simply not accessible from the script, although it is available in the process data.

If I change the Calculated Property script to simply return the value of the variable as bellow:

return this.llista-finques;

or even someting that simply should return a string:

return this.llista-finques[0].FIN_ID

the calculated property produces no result. If I do exaclty the same with any of the other process variables that are not arrays of objects the calculated property seems to work correctly.

Al the testing I have done is using the screen preview debuging tools of Processmaker 4.

Is there a limitation on the kind of variables I can use for calculated properties? Is this a processmaker bug?

osantos
  • 352
  • 2
  • 18

1 Answers1

0

This is embarassing ... after testing and testing and testing I figured out that the problem was due to the name of the variable I was using. Can't use a name with the character '-' .... Once I corrected the variable name it all worked as expected.

osantos
  • 352
  • 2
  • 18