To edit on multiple rows along with functionality

Hi team,

I have requirement such that user can edit single rows and multiple rows as well and while using pm I'm able to edit single and multiple rows as well but there is another requirement such that while editing user  can only edit 2 columns name as: "Electrical Tilt" and "Comment" but while editing electrical tilt on single or multiple row user has to make sure if combination of these 3 columns: "Shared Antenna", "Transmitter", "Antenna PAFX"  are exactly same on any row then electrical tilt of those rows will automatically gets updated 

I have mentioned the code of edit UI, please let me know what could be the best approach to follow

a!localVariables(
  local!isShowtoSite,
  local!siteDetails: rule!SLS_QRY_getSiteSummaryDetails(siteName: ri!siteId),
  local!data: ri!transmitterDetails,
  local!updatedData: difference(local!data, ri!transmitterDetails),
  {
    a!columnsLayout(
      columns: {
        a!columnLayout(
          contents: {
            a!cardLayout(
              contents: a!richTextDisplayField(
                labelPosition: "COLLAPSED",
                value: {
                  a!richTextIcon(color: "ACCENT", icon: "arrow-left")
                },
                showWhen: true,
                align: "CENTER"
              ),
              link: a!startProcessLink(
                processModel: cons!SLS_PM_BACK_TO_VERSION_MANAGEMENT,
                processParameters: {
                  siteId: ri!siteId,
                  versionId: ri!versionId,
                  isShowtoSite: local!isShowtoSite,
                  isShow: false
                }
              ),
              tooltip: "Back To Electrical Tilt",
              shape: "ROUNDED"
            ),
            
          },
          width: "EXTRA_NARROW"
        ),
        
      }
    ),
    a!sectionLayout(
      label: "Electrical Tilt",
      contents: {
        a!gridLayout(
          label: "",
          labelPosition: "ABOVE",
          headerCells: {
            a!gridLayoutHeaderCell(label: "Site", align: "CENTER"),
            a!gridLayoutHeaderCell(label: "FBAND", align: "CENTER"),
            a!gridLayoutHeaderCell(label: "Band", align: "CENTER"),
            a!gridLayoutHeaderCell(label: "Shared Antenna", align: "CENTER"),
            a!gridLayoutHeaderCell(label: "Transmitter", align: "CENTER"),
            a!gridLayoutHeaderCell(
              label: "Transmitter Status",
              align: "CENTER"
            ),
            a!gridLayoutHeaderCell(
              label: "Antenna PAFX",
              align: "CENTER"
            ),
            a!gridLayoutHeaderCell(
              label: "Electrical Tilt",
              align: "CENTER",
              helpTooltip: "Range should be from -99 to 99."
            ),
            a!gridLayoutHeaderCell(label: "Comment *", align: "CENTER"),
            
          },
          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: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            
          },
          rows: {
            a!forEach(
              items: local!data,
              expression: a!localVariables(
                local!isEditable: true(),
                a!gridRowLayout(
                  contents: {
                    a!textField(
                      label: "Site",
                      value: index(
                        local!siteDetails,
                        'recordType!{9441efd7-521a-4695-82a7-d661a237c67d}SLS Site Sync.fields.{cc433436-7922-4ef6-8ca6-5ed4c1580901}SLSSiteName',
                        {}
                      ),
                      readOnly: true
                    ),
                    a!textField(
                      label: "F Band",
                      value: fv!item['recordType!{5bcd9424-97e1-4cf7-8c9a-db17184cd421}SLS Transmitter Details Sync.relationships.{74faaa4b-1bf8-46dd-9c1d-3319079ec944}bandSync.fields.{c51f3cc4-d265-460c-9304-ce8424789fce}fband'],
                      readOnly: true
                    ),
                    a!textField(
                      label: "Band",
                      value: fv!item['recordType!{5bcd9424-97e1-4cf7-8c9a-db17184cd421}SLS Transmitter Details Sync.relationships.{74faaa4b-1bf8-46dd-9c1d-3319079ec944}bandSync.relationships.{b9cfac62-9de0-41f8-a774-5b9cb6eaf786}subBandSync.fields.{4b95a91a-aa36-4f3d-8b0f-7466e8ac54ac}sband'],
                      readOnly: true
                    ),
                    a!textField(
                      label: "Shared Antenna",
                      value: fv!item['recordType!{5bcd9424-97e1-4cf7-8c9a-db17184cd421}SLS Transmitter Details Sync.fields.{046fc054-603c-45de-9c8f-cd445cd22a5c}sharedMastNumber'],
                      readOnly: true
                    ),
                    a!textField(
                      label: "Transmitter",
                      value: fv!item['recordType!{5bcd9424-97e1-4cf7-8c9a-db17184cd421}SLS Transmitter Details Sync.fields.{be5f8d46-1e65-44ba-9cbd-aed866941ef8}txId'],
                      readOnly: true
                    ),
                    a!textField(
                      label: "Transmitter Status",
                      value: fv!item['recordType!{5bcd9424-97e1-4cf7-8c9a-db17184cd421}SLS Transmitter Details Sync.relationships.{84769e18-446e-4758-b7fe-d281d72ab228}transmitterStatusSync.fields.{f3914d75-4b03-4ec1-a34e-1b1ff897af47}transmitterStatus'],
                      readOnly: true
                    ),
                    a!textField(
                      label: "Antenna PAFX",
                      value: fv!item['recordType!{5bcd9424-97e1-4cf7-8c9a-db17184cd421}SLS Transmitter Details Sync.relationships.{3c30cebe-2f4e-451b-9ab3-746818e7f1cc}versionAntennaSync.relationships.{82080e5c-9ebc-49d6-99df-3eeb992a712a}physicalAntennaSync.fields.{80025c1b-2fa5-4c4f-ae47-2a9acbd6d2c3}description'],
                      readOnly: true
                    ),
                    a!integerField(
                      label: "Electrical Tilt",
                      value: fv!item['recordType!{5bcd9424-97e1-4cf7-8c9a-db17184cd421}SLS Transmitter Details Sync.fields.{a5312671-5aa1-46a8-a244-d36d73910a0f}electricalTilt'],
                      saveInto: {
                        a!save(
                          fv!item['recordType!{5bcd9424-97e1-4cf7-8c9a-db17184cd421}SLS Transmitter Details Sync.fields.{a5312671-5aa1-46a8-a244-d36d73910a0f}electricalTilt'],
                          save!value
                        )
                      },
                      readOnly: not(local!isEditable),
                      
                    ),
                    a!paragraphField(
                      label: "Comment",
                      value: fv!item['recordType!{5bcd9424-97e1-4cf7-8c9a-db17184cd421}SLS Transmitter Details Sync.fields.{b7c34245-2c0f-4404-b93f-9d81fd168932}etiltComment'],
                      saveInto: {
                        a!save(
                          fv!item['recordType!{5bcd9424-97e1-4cf7-8c9a-db17184cd421}SLS Transmitter Details Sync.fields.{b7c34245-2c0f-4404-b93f-9d81fd168932}etiltComment'],
                          save!value
                        )
                      },
                      readOnly: not(local!isEditable),
                      required: true(),
                      
                    ),
                    
                  }
                )
              )
            )
          },
          selectionSaveInto: {},
          validations: null,
          shadeAlternateRows: true
        )
      }
    ),
    a!columnsLayout(
      columns: a!columnLayout(
        contents: a!buttonArrayLayout(
          buttons: {
            a!buttonWidget(
              label: "Save",
              confirmHeader: "Are you sure ?",
              submit: true,
              disabled: a!isNullOrEmpty(ri!transmitterDetails),
              style: "OUTLINE",
              validate: true,
              confirmMessage: "Are you sure you want to submit.",
              confirmButtonLabel: "Yes",
              cancelButtonLabel: "No",
              saveInto: {
                a!save(
                  ri!updatedTransmitterDetails,
                  local!updatedData
                ),
                a!save(ri!cancel, false())
              }
            ),
            a!buttonWidget(
              label: "Cancel",
              value: true,
              confirmHeader: "Are you sure you want to Cancel?",
              confirmButtonLabel: "Yes",
              cancelButtonLabel: "No",
              submit: true,
              saveInto: ri!cancel,
              style: "OUTLINE",
              color: "NEGATIVE",
              validate: false
            )
          },
          align: "END"
        ),
        width: "1X"
      )
    )
  }
)

 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Something like this?

    a!localVariables(
      local!values: {
        a!map(
          id: 1,
          sharedAntenna: "value 1",
          transmitter: "value2",
          antennaPAFX: "value3",
          electricalTile: 4
        ),
        a!map(
          id: 2,
          sharedAntenna: "value 1",
          transmitter: "value2",
          antennaPAFX: "value3",
          electricalTile: 4
        ),
        a!map(
          id: 3,
          sharedAntenna: "value 1",
          transmitter: "value2",
          antennaPAFX: "value3",
          electricalTile: 4
        )
      },
      a!gridLayout(
        headerCells: {
          a!gridLayoutHeaderCell(label: "Shared Antenna"),
          a!gridLayoutHeaderCell(label: "Transmitter"),
          a!gridLayoutHeaderCell(label: "Antenna PAFX"),
          a!gridLayoutHeaderCell(label: "Electrical Tilt ")
        },
        rows: a!forEach(
          items: local!values,
          expression: a!gridRowLayout(
            contents: {
              a!textField(
                value: fv!item.sharedAntenna,
                saveInto: {
                  fv!item.sharedAntenna,
                  if(
                    and(
                      fv!item.sharedAntenna = fv!item.transmitter,
                      fv!item.sharedAntenna = fv!item.antennaPAFX
                    ),
                    a!save(fv!item.electricalTile, 99),
                    {}
                  )
                }
              ),
              a!textField(
                value: fv!item.transmitter,
                saveInto: {
                  fv!item.transmitter,
                  if(
                    and(
                      fv!item.sharedAntenna = fv!item.transmitter,
                      fv!item.sharedAntenna = fv!item.antennaPAFX
                    ),
                    a!save(fv!item.electricalTile, 99),
                    {}
                  )
                }
              ),
              a!textField(
                value: fv!item.antennaPAFX,
                saveInto: {
                  fv!item.antennaPAFX,
                  if(
                    and(
                      fv!item.sharedAntenna = fv!item.transmitter,
                      fv!item.sharedAntenna = fv!item.antennaPAFX
                    ),
                    a!save(fv!item.electricalTile, 99),
                    {}
                  )
                }
              ),
              a!integerField(
                value: fv!item.electricalTile,
                saveInto: fv!item.electricalTile
              )
            }
          )
        )
      )
    )

  • 0
    Certified Lead Developer
    in reply to Mathieu Drouin

    Here's another a another variation using update/index/wherecontains.

    a!localVariables(
      local!values: {
        a!map(
          site: 1,
          antenna: "abc",
          trx: "123",
          tilt: null()
        ),
        a!map(
          site: 2,
          antenna: "xyz",
          trx: "543",
          tilt: null()
        ),
        a!map(
          site: 3,
          antenna: "abc",
          trx: "123",
          tilt: null()
        ),
        a!map(
          site: 4,
          antenna: "qwer",
          trx: "3.14",
          tilt: null()
        ),
        a!map(
          site: 5,
          antenna: "abc",
          trx: "123",
          tilt: null()
        ),
        a!map(
          site: 6,
          antenna: "zxcv",
          trx: "42",
          tilt: null()
        )
      },
      local!valuesWithIndex: a!refreshVariable(
        value: a!forEach(
          items: local!values,
          expression: a!update(
            fv!item,
            "concatenatedIndex",
            concat(
              fv!item.antenna,
              fv!item.trx,
              fv!item.antennaPAFX
            )
          )
        ),
        refreshOnReferencedVarChange: true
      ),
      a!gridLayout(
        headerCells: {
          a!gridLayoutHeaderCell(label: "Antenna"),
          a!gridLayoutHeaderCell(label: "Transmitter"),
          a!gridLayoutHeaderCell(label: "Tilt")
        },
        rows: a!forEach(
          items: local!values,
          expression: a!gridRowLayout(
            contents: {
              a!textField(value: fv!item.antenna, readOnly: true),
              a!textField(value: fv!item.trx, readOnly: true),
              a!integerField(
                value: fv!item.tilt,
                saveInto: {
                  fv!item.tilt,
                  a!localVariables(
                    local!itemIndexes: wherecontains(
                      concat(fv!item.antenna, fv!item.trx),
                      local!valuesWithIndex.concatenatedIndex
                    ),
                    local!items: index(
                      local!valuesWithIndex,
                      local!itemIndexes
                    ),
                    {
                      a!save(
                        local!values,
                        a!update(
                          local!values,
                          local!itemIndexes,
                          a!update(local!items, { "tilt" }, { fv!item.tilt })
                        )
                      )
                    }
                  )
                }
              )
            }
          )
        )
      )
    )

Reply
  • 0
    Certified Lead Developer
    in reply to Mathieu Drouin

    Here's another a another variation using update/index/wherecontains.

    a!localVariables(
      local!values: {
        a!map(
          site: 1,
          antenna: "abc",
          trx: "123",
          tilt: null()
        ),
        a!map(
          site: 2,
          antenna: "xyz",
          trx: "543",
          tilt: null()
        ),
        a!map(
          site: 3,
          antenna: "abc",
          trx: "123",
          tilt: null()
        ),
        a!map(
          site: 4,
          antenna: "qwer",
          trx: "3.14",
          tilt: null()
        ),
        a!map(
          site: 5,
          antenna: "abc",
          trx: "123",
          tilt: null()
        ),
        a!map(
          site: 6,
          antenna: "zxcv",
          trx: "42",
          tilt: null()
        )
      },
      local!valuesWithIndex: a!refreshVariable(
        value: a!forEach(
          items: local!values,
          expression: a!update(
            fv!item,
            "concatenatedIndex",
            concat(
              fv!item.antenna,
              fv!item.trx,
              fv!item.antennaPAFX
            )
          )
        ),
        refreshOnReferencedVarChange: true
      ),
      a!gridLayout(
        headerCells: {
          a!gridLayoutHeaderCell(label: "Antenna"),
          a!gridLayoutHeaderCell(label: "Transmitter"),
          a!gridLayoutHeaderCell(label: "Tilt")
        },
        rows: a!forEach(
          items: local!values,
          expression: a!gridRowLayout(
            contents: {
              a!textField(value: fv!item.antenna, readOnly: true),
              a!textField(value: fv!item.trx, readOnly: true),
              a!integerField(
                value: fv!item.tilt,
                saveInto: {
                  fv!item.tilt,
                  a!localVariables(
                    local!itemIndexes: wherecontains(
                      concat(fv!item.antenna, fv!item.trx),
                      local!valuesWithIndex.concatenatedIndex
                    ),
                    local!items: index(
                      local!valuesWithIndex,
                      local!itemIndexes
                    ),
                    {
                      a!save(
                        local!values,
                        a!update(
                          local!values,
                          local!itemIndexes,
                          a!update(local!items, { "tilt" }, { fv!item.tilt })
                        )
                      )
                    }
                  )
                }
              )
            }
          )
        )
      )
    )

Children
No Data