Problem with the result of ER

Hello, 

I would need the result of this Expression Rule in cod_provincia show me only the code of the provincia to which the municipio belongs. However, it is returning all the codes from my provincias table. 

What am I doing wrong?

Thanks in advance. 

  Discussion posts and replies are publicly visible

Parents
  • Your code is doing exactly what you're asking it to do, which is setting the value of cod_provincia to ALL the values you retrieved into your 'query2' local variable. If you are wanting to basically perform a "lookup" of the cod_proivincia based upon the value of the cod_municipio then you need to perform a fn!wherecontains() on the value of query2 based upon the value of the cod_municipio in the current iteration of your loop. But wihtout seeing the data you've retrieved into 'query' or 'query2' or the exact definitions of the relationships between those datasets it's hard to  be precise.

Reply
  • Your code is doing exactly what you're asking it to do, which is setting the value of cod_provincia to ALL the values you retrieved into your 'query2' local variable. If you are wanting to basically perform a "lookup" of the cod_proivincia based upon the value of the cod_municipio then you need to perform a fn!wherecontains() on the value of query2 based upon the value of the cod_municipio in the current iteration of your loop. But wihtout seeing the data you've retrieved into 'query' or 'query2' or the exact definitions of the relationships between those datasets it's hard to  be precise.

Children