Help with foreach, on a map or cdt, from related records.
Hello, I require your support, well, I have a problem, or rather a very big doubt, is it possible to do a foreach to get data from related records?
For example:
supposing I have the following records:
Record Person
Record Address
Record Account
Record idRelationship
the record idRelationship record will help me to relate the other records by means of an id. so far so good, (I hope I understand)
then, I need to make an expression rule that will bring me the ordered data for a cdt, or a map, 'this is for formatting purposes'.
what i am doing is relating my records, and inserting data,
I am first sorting them by local variables
localVariables(
local!relationship:rule....(relationship: Record idRelationship....)
local!getOwner:{
Record Person
Record Address
Record Account
}
local!getBenef:{
Record Person
Record Address
Record Account
}
is something like this, so after I do my indexing, what I do is create another local variable that does my foreach, but for each 'beneficiary' that I have that I have related in my Record idRelationship table,
for example...
local!iteration:enumerate(length(local!getBenef))+1
and I create a foreach
local!beneficiaries:a!foreach(
items:local!iteration,
expression:type!cdt{
..
..
..
birthDt:index(local!getBenef,Record Person.dateBirth,null)
..
...
}
)
)
something like this would be my code, supposing I have 2 persons data that are in my table, related to my record, I am getting a result like this ....
type!cdt{
dateBirth: 2/21/1998; 8/12/2004;
}
type!cdt{
dateBirth: 2/21/1998; 8/12/2004;
}
when I require them to be like this
type!cdt{
dateBorn: 8/12/2004,
}
type!cdt{
dateBorn: 2/21/1998,
}
additional, I attach an example of a photograph...

is there another way to do it, or am I indexing wrong? I hope I'm making myself clear, I'm a bit frustrated... I really appreciate you reading this far .... thank you!
