How to copy values of a filled editable grid into another grid in an interface

Hi! I have an editable grid which is filled by the user (possible to add new rows), like in this example:

The editable grid values are saved in a Record, and they all have a common field for each grid created (for example, Employee Set 1, even though it is not shown in the example it should be another column)

Now, I would like to "copy" the created matrix into a grid in another interface, being able to create new columns but  without the possibility of adding extra-rows (I mean, without the "Add Employee" dynamic link)

To be clear, my idea is to re-use the data in another grid, and add a column to identify the data for a new purpose

Thanks a lot!

  Discussion posts and replies are publicly visible

  • Alright, step by step:

    1) Record Type Constructor: I still don´t know why I should create fake data by this way. Until now, for my editable grids filled by hand for the user, I directly created my local variable (empty) and then replaced it with the data introduced by the user

    2) Editable grid: I removed the addrowlink correctly

    Now, I´m still not sure how to manage to "replace the fake data with real data"

    1. Grid I want to "copy" / "query"

    2. Editable grid I want to replace with data of the last grid

    My first trial of new code (not working)

    Any help with the code would be useful! Thanks again

    a!localVariables(
      local!grid,
      {
        a!sectionLayout(
          label: "Líneas Factura",
          labelIcon: "list-alt-solid",
          contents: {
            a!gridLayout(
              label: "A continuación, incorpore las líneas de factura correspondientes y pulse el botón de creación",
              headerCells: {
                a!gridLayoutHeaderCell(label: "Linea Pedido"),
                a!gridLayoutHeaderCell(label: "Pedido"),
                a!gridLayoutHeaderCell(label: "Proveedor"),
                a!gridLayoutHeaderCell(label: "Material"),
                a!gridLayoutHeaderCell(label: "Precio Unitario"),
                a!gridLayoutHeaderCell(label: "Cantidad"),
                a!gridLayoutHeaderCell(label: "Importe Total"),
                a!gridLayoutHeaderCell()
              },
              columnConfigs: {
                a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
                a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
                a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
                a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
                a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
                a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
                a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
                a!gridLayoutColumnConfig(width: "ICON")
              },
              rows: a!forEach(
                items: ri!recordLineasPedido,
                expression: a!gridRowLayout(
                  contents: {
                    a!textField(
                      value: fv!index,
                      saveInto: fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{181742a7-4305-4134-b05e-4eebc9c56292}idLineaFactura']
                    ),
                    a!textField(
                      value: fv!index,
                      saveInto: fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{60774c8e-9b47-486f-9fea-b32c525c05fd}idPedido']
                    ),
                    a!textField(
                      value: fv!index,
                      saveInto: fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{844be35b-6de5-434e-9c69-e7c7b8a148dd}proveedor']
                    ),
                    a!textField(
                      value: fv!index,
                      saveInto: fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{019eb28b-727b-4e2c-8160-1bcf8a747ef1}material']
                    ),
                    a!integerField(
                      value: fv!index,
                      saveInto: fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{eda9bda7-ae57-44e7-a651-d097c8581021}precioUnit']
                    ),
                    a!floatingPointField(
                      value: fv!index,
                      saveInto: fv!item['recordType!{6e637180-b344-49d2-a1f7-f87eed0041ba}CPF Lineas Factura.fields.{53f231a2-9bf7-40a1-af07-74373fa7bd9f}importe']
                    )
                  }
                )
              )
            )
          }
        ),
        a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "Completar Creación Factura",
              saveInto: a!save(ri!recordLineasFact, local!grid),
              submit: true,
              style: "PRIMARY",
              validate: true
            )
          },
          secondaryButtons: {
            a!buttonWidget(
              label: "Cancelar",
              value: true,
              saveInto: ri!cancel2,
              submit: true,
              style: "NORMAL",
              validate: false
            )
          }
        )
      }
    )

  • 0
    Certified Lead Developer
    in reply to carlosp5114

    Well, an empty grid without an option to add any rows is a bit boring and hard to test. That's what the fake data is for.

    Once things work, use a!queryRecordType to load the data into that local, replacing the fake data.

    BTW, I am not sure what exactly you mean with "data from the last grid". My assumption is that you store this data to the database as the user submits that form.