Skip to main content
November 1, 2021
Question

Problem with the result of ER

  • November 1, 2021
  • 5 replies
  • 0 views

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. 

5 replies

stewart.burchell
November 1, 2021

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.

November 1, 2021

Thanks for your answer.

But, could you put an example to make the fn whereContains?
In 'query' I am collecting all the municipios and in 'query2' all the provincias.
These tables are related, with provincias being the parent table and municipios being the child.
The foreign key is cod_provincia.

stewart.burchell
November 1, 2021

You'll have to provide a bit more detail about what the result should be. For a given Municipios what value(s) should be appearing in the 'cod_provincia' attribute of the TIE_Municipios datatype?