Reputation: 51
I have two SDT collections with the following structures:
Areas (collection)
L Area (structure)
L Codigo (char 20)
Orden (num 2.0)
Rojo (num 3.0)
Verde (num 3.0)
Azul (num 3.0)
Mostrar (char 10)
Camas (SDT Camas)
Camas (collection)
L Cama (structure)
L Id (num 8.0)
Paciente (num 8.0)
Edad (char 10)
Nombre (char 30)
Comienzo (datetime)
Duracion (char 10)
Evento (num 8.0)
Area (char 20)
Cama (char 20)
Sector (char 20)
Then, I have a Web Panel with one Free Style Grid based on Areas
SDT collection through an &areas
variable. Inside that Grid I have a normal Grid based on the Camas
SDT collection through &areas.item(0).Camas
.
This works well enough. The panel has a block for each area thanks to the Free Style Grid, and inside each block I have a list of each area's 'camas' (beds) through the normal Grids.
Now I need to make the Nombre
control for each sub grid clickable and make so the data in Paciente
is saved to the WebSession of the user. I thought I could use &areas.CurrentItem.Camas.CurrentItem.Paciente
but that doesn't work.
What would I need to do to access a sub grid's data when clicking its control?
I'm using Genexus 16 btw.
Upvotes: 1
Views: 398
Reputation: 51
Managed to get the behavior I wanted.
Instead of basing the subgrid on the &areas.item(0).Camas
collection, I removed the reference to the collection and used a &cama
variable based on the Camas.Cama
substructure for all items inside the grid. I also added a &paciente
variable to the grid. Then, I just loaded each &cama
while looping inside the &areas.CurrentItem.Camas
collection, and gave &paciente the same value as '&cama.Paciente'.
After that, I can access the data I wanted through the &paciente
variable when executing the click event of any control inside the sub grid.
Code:
Event GridAreaCamas.Load
For &cama in &areas.CurrentItem.Camas
&paciente = &cama.Paciente
GridAreaCamas.Load()
EndFor
EndEvent
Event ctlPacienteNombreCompleto.Click
&webSession.Set(!"paciente_seleccionado", &paciente.ToString())
EndEvent
Upvotes: 1