Change all rows in an editable grid with same order no

Certified Associate Developer

So I have a requirement to create an interface that allows management to view and prioritize orders.  I have created and editable grid, but the issue is some lines have the same "order no"  and I will need to to automatically change all rows with the same order no as the one that was changed.

Any thoughts?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Well, If I understood the problem correctly, this can be done within the saveInto attribute of the Order No column. Apparently, something like this

    a!gridRowLayout(
                contents: {
                  a!integerField(
                    value: fv!item.order_No,
                    saveInto: {
                      fv!item.order_No,
                      a!foreach(
                        local!items,
                        a!save(fv!item.order_No, save!value)
                      )
                    }
                  ),
                 /*Rest of the code*/
            )

    Here local!items hold the data and upon updation on Order No in any row, I am updating the entire data array's Order No to the latest entered Order No.

    Hope this helps!

  • 0
    Certified Associate Developer
    in reply to Harsha Sharma

    I am sorry I was unclear.  What I am attempting to do is change a priority order number but it change all rows with the same order number.  For example in the picture, if I change the 3 to a 1 in one row with order number 1255777, then it would change the other 2 rows.

  • 0
    Certified Lead Developer
    in reply to AllenP

    Is this functionality supposed to affect just one specific field, or all fields?  If you need to build in a workaround to do this, it should be doable, but if it's going to be bigger than one specific spot, I'd consider taking a different approach.  Especially given that if these rows are supposed to have identical data, then there isn't much point in even having multiple rows as far as I can see.

    Also: did you post a picture?  I don't see a picture in your original post.

  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    I neglected to add the picture, but just did.  Basically just need an interface to show open orders that list item, order no and due date and allow management to change a priority no as needed for expedited orders.

  • 0
    Certified Lead Developer
    in reply to AllenP

    Here's an example interface that does approximately what you're saying you need.  The saveInto for the priority number field manually reassembles an array of all priority numbers for the whole initial array, only updating those where the Order Num is the same.

    a!localVariables(
      
      local!orders: {
        a!map(
          id: 1,
          orderNum: "asdf1234",
          priority: 3,
          item: "MacGuffin"
        ),
        a!map(
          id: 2,
          orderNum: "qwer5432",
          priority: 1,
          item: "DooHickey"
        ),
        a!map(
          id: 3,
          orderNum: "asdf1234",
          priority: 4,
          item: "Whatchamacallit"
        ),
        a!map(
          id: 4,
          orderNum: "asdf1234",
          priority: 3,
          item: "Whoosiedink"
        )
      },
      
      
      a!gridLayout(
        headerCells: {
          a!gridLayoutHeaderCell(label: "Priority"),
          a!gridLayoutHeaderCell(label: "Order Num"),
          a!gridLayoutHeaderCell(label: "Item")
        },
        rows: a!forEach(
          local!orders,
          a!localVariables(
            local!currentOrderNum: fv!item.orderNum,
            a!gridRowLayout(
              contents: {
                a!textField(
                  label: "priority column",
                  value: fv!item.priority,
                  saveInto: {
                    /*fv!item.priority*/
                    a!save(
                      local!orders.priority,
                      a!forEach(
                        local!orders,
                        if(
                          fv!item.orderNum = local!currentOrderNum,
                          save!value,
                          fv!item.priority
                        )
                      )
                    )
                  }
                ),
                a!textField(
                  label: "Order Num Column",
                  value: fv!item.orderNum,
                  readOnly: true()
                ),
                a!textField(
                  label: "Item Name",
                  value: fv!item.item,
                  readOnly: true()
                )
              }
            )
          )
        )
      )
    )

Reply
  • 0
    Certified Lead Developer
    in reply to AllenP

    Here's an example interface that does approximately what you're saying you need.  The saveInto for the priority number field manually reassembles an array of all priority numbers for the whole initial array, only updating those where the Order Num is the same.

    a!localVariables(
      
      local!orders: {
        a!map(
          id: 1,
          orderNum: "asdf1234",
          priority: 3,
          item: "MacGuffin"
        ),
        a!map(
          id: 2,
          orderNum: "qwer5432",
          priority: 1,
          item: "DooHickey"
        ),
        a!map(
          id: 3,
          orderNum: "asdf1234",
          priority: 4,
          item: "Whatchamacallit"
        ),
        a!map(
          id: 4,
          orderNum: "asdf1234",
          priority: 3,
          item: "Whoosiedink"
        )
      },
      
      
      a!gridLayout(
        headerCells: {
          a!gridLayoutHeaderCell(label: "Priority"),
          a!gridLayoutHeaderCell(label: "Order Num"),
          a!gridLayoutHeaderCell(label: "Item")
        },
        rows: a!forEach(
          local!orders,
          a!localVariables(
            local!currentOrderNum: fv!item.orderNum,
            a!gridRowLayout(
              contents: {
                a!textField(
                  label: "priority column",
                  value: fv!item.priority,
                  saveInto: {
                    /*fv!item.priority*/
                    a!save(
                      local!orders.priority,
                      a!forEach(
                        local!orders,
                        if(
                          fv!item.orderNum = local!currentOrderNum,
                          save!value,
                          fv!item.priority
                        )
                      )
                    )
                  }
                ),
                a!textField(
                  label: "Order Num Column",
                  value: fv!item.orderNum,
                  readOnly: true()
                ),
                a!textField(
                  label: "Item Name",
                  value: fv!item.item,
                  readOnly: true()
                )
              }
            )
          )
        )
      )
    )

Children
No Data