Search code examples
genexus

Move record from one grid to another (Genexus x evo 1 )


I'm currently working with GeneXus X Evolution 1 in a windows form application.

I can't seem to find the correct way to move selected records from one grid to another.

All I can do is move the selected record in the first grid to the first row of the second grid.

This is what I see when I select the first record:

Select first record

And this when the second one is selected:

When i select the second record or any other

My code looks like:

Event &LineaSeleccionadaGrilla.Click
    if &LineaSeleccionadaGrilla = true
        &ProdSelGrilla = ''
        &ProdSelGrilla = ProdId 
        &i = &i + 1 
        if &i <= rows(&ArregloProdSel())
            &ArregloProdSel(&i,1) = &ProdSelGrilla
            &ProdidSeleccion.AddItem(str(&i),&ArregloProdSel(&i,1) ) 
        endif
        grillafinal.Refresh()
    endif       
EndEvent

Event grillafinal.Load // esto carga la grilla
    &ProdIdFinal = &ProdSelGrilla
EndEvent

Solution

  • The problem seems to be that in the grillafinal.Load event, you are loading only the last selected record.

    Assuming &ArregloProdSel is a collection of ProdId (don't know why it is a matrix and not just an array, though), your grillafinal.Load event should look something like this:

    Event grillafinal.Load
        for &j = 1 to rows(&ArregloProdSel())
            &ProdIdFinal = &ArregloProdSel(&j,1)
            Load
        endfor
    EndEvent