How to connect a data store to a record

Hi! I used to work with records, uploading the data based on a manual task in an interface (user introduces parameters and the record updates the info). However, I had to use a data store entity for an editable grid programmation, and I dont know if there is a chance to upload the record based on the data store entity. Thanks!

  Discussion posts and replies are publicly visible

  • I include my entire code, remaining the same error:

    a!localVariables(
      local!data,
      {
      a!gridLayout(
        label: "Invoice Details",
        headerCells: {
          a!gridLayoutHeaderCell(label: "Purchase Order"),
          a!gridLayoutHeaderCell(label: "Date"),
          a!gridLayoutHeaderCell(label: "Total Value"),
          a!gridLayoutHeaderCell(label: "Material"),
          a!gridLayoutHeaderCell(label: "Supplier"),
          a!gridLayoutHeaderCell(),
          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:"ICON"),
          a!gridLayoutColumnConfig(width:"ICON")
          
        },
        rows: a!forEach(
          items: local!data,
          expression: a!gridRowLayout(
            contents: {
              a!textField(
                value:fv!item['recordType!{d269796e-dcd7-46b6-8ecf-55ed16bf54a1}PTPP Invoice Lines.fields.{ab97d392-b365-425a-a0e5-116da756c87a}id_orden'], 
                saveInto: fv!item['recordType!{d269796e-dcd7-46b6-8ecf-55ed16bf54a1}PTPP Invoice Lines.fields.{ab97d392-b365-425a-a0e5-116da756c87a}id_orden'],
                required: true                    
              ),
              a!textField(
                value:fv!item['recordType!{d269796e-dcd7-46b6-8ecf-55ed16bf54a1}PTPP Invoice Lines.fields.{25003162-d3d0-4466-86f8-471cb1e37589}fecha_orden'], 
                saveInto: fv!item['recordType!{d269796e-dcd7-46b6-8ecf-55ed16bf54a1}PTPP Invoice Lines.fields.{25003162-d3d0-4466-86f8-471cb1e37589}fecha_orden'],
                required: true                    
              ),
              a!textField(
                value:fv!item['recordType!{d269796e-dcd7-46b6-8ecf-55ed16bf54a1}PTPP Invoice Lines.fields.{c228ed4c-21cb-4af4-a313-88f26e7874da}total_orden'], 
                saveInto: fv!item['recordType!{d269796e-dcd7-46b6-8ecf-55ed16bf54a1}PTPP Invoice Lines.fields.{c228ed4c-21cb-4af4-a313-88f26e7874da}total_orden'],
                required: true                    
              ),
              a!textField(
                value:fv!item['recordType!{d269796e-dcd7-46b6-8ecf-55ed16bf54a1}PTPP Invoice Lines.fields.{5f4060f6-827d-41b5-88e7-0328ec1309bc}Material'], 
                saveInto: fv!item['recordType!{d269796e-dcd7-46b6-8ecf-55ed16bf54a1}PTPP Invoice Lines.fields.{5f4060f6-827d-41b5-88e7-0328ec1309bc}Material'],
                required: true                    
              ),
              a!textField(
                value:fv!item['recordType!{d269796e-dcd7-46b6-8ecf-55ed16bf54a1}PTPP Invoice Lines.fields.{d9317466-7426-47af-bd64-22a998c636e6}id_proveedor'], 
                saveInto: fv!item['recordType!{d269796e-dcd7-46b6-8ecf-55ed16bf54a1}PTPP Invoice Lines.fields.{d9317466-7426-47af-bd64-22a998c636e6}id_proveedor'],
                required: true                 
    
              ),
              a!richTextDisplayField(
                value: {
                  a!richTextIcon(
                  icon: "times-circle",
                  link: a!dynamicLink(
                    saveInto: local!data,
                    value: remove(local!data, fv!index)
                  ),
                  linkstyle: "STANDALONE",
                  color: "NEGATIVE",
                  showwhen: a!isNullOrEmpty(fv!item['recordType!{d269796e-dcd7-46b6-8ecf-55ed16bf54a1}PTPP Invoice Lines.fields.{ab97d392-b365-425a-a0e5-116da756c87a}id_orden'])
                  )
                , 
                  a!richTextIcon(
                   icon: "trash",
                   color: "NEGATIVE",
                   showWhen: a!isNotNullOrEmpty(
                     fv!item['recordType!{d269796e-dcd7-46b6-8ecf-55ed16bf54a1}PTPP Invoice Lines.fields.{ab97d392-b365-425a-a0e5-116da756c87a}id_orden']),
                     
                   link: a!dynamicLink(
                     saveInto: local!data,
                     value: remove(local!data, fv!index)
                   )
                   
                )
                }
              ),
              a!richTextDisplayField(
                value: a!richTextIcon(
                  showWhen: a!isNotNullOrEmpty(
                    fv!item['recordType!{d269796e-dcd7-46b6-8ecf-55ed16bf54a1}PTPP Invoice Lines.fields.{ab97d392-b365-425a-a0e5-116da756c87a}id_orden']),
                  icon: "floppy-o",
                  color: "POSITIVE"
                )
              )
            }
          )
        ),
        addrowlink: a!dynamicLink(
          saveInto: local!data,
          value: append(
            local!data, 
           'recordType!{d269796e-dcd7-46b6-8ecf-55ed16bf54a1}PTPP Invoice Lines'()
          ),
          label: "Add new Invoice Line"
        )
        ),
      a!buttonArrayLayout(
        align: "END",
        buttons: {
          a!buttonWidget(
            label: "Write to the Database",
            style: "PRIMARY",
            saveInto: a!writeRecords(
              records:local!data,
              onSuccess: a!save(local!data, fv!recordsUpdated)
            ),
            validate:true
          )
        }
      )
    }  
    )     

  • 0
    Certified Lead Developer
    in reply to carlosp5114

    OK. And the error shows up when your do ... what?

  • the error shows up at the moment I replace the a!text field with the record fields

                  a!textField(value:fv!item.idOrden, saveInto: fv!item.idOrden), --->  a!textField(value:fv!item[record])

    Could this error happen because in my record I have different types of data? (text and dates). It´s the only difference I found comparing with the video

  • 0
    Certified Lead Developer
    in reply to carlosp5114

    I think this is because the is "something" in that local variable. To make sure this is an empty list, can you try to change the definition of that local to "{}" and click the "TEST" button.