Updating data in from a grid without overwriting the ids

Certified Senior Developer

I am trying to save data that is updated in an editable grid, but when I save the data - everything saves correctly except that the ids. Existing table, ABC_Customer has id, name, accountNum, fiId, effectiveDate. I have a read only grid that the allows the user to select which rows to update. the selection of rows is then displayed in a new grid that has editable data. 

This is a follow-on question related to a previous post of mine, but since it's a new topic - thought I'd create a new item. Anyway - this is what I hav

        a!dropdownField(
          label: "Account Number "&fv!index,
          choiceLabels: {ri!selectedAccount_cdt.accountNum, ri!newAccount_cdt.accountnum},
          choiceValues: {ri!selectedAccount_cdt.accountNum, ri!newAccount_cdt.accountnum},
          value: fv!item.accountNum,
          saveInto: {fv!item.accountNum,
              if(fv!item.accountNum = ri!newAccount_cdt.accountNum,
              a!save(
              target: ri!updatedCustomerAccount_cdt.fiId, 
              value: ri!newAccount_cdt.fiId
              ),
              a!save(
              target: ri!updatedCustomerAccount_cdt.fiId,
              value: local!selectedRows.fiId
              )
              ),
              if(fv!item.accountNum = ri!newAccount_cdt.accountNum,
              a!save(
                target: ri!updatedCustomerAccount_cdt.effectiveDate, 
                value: today()
              ),
              a!save(
                target: ri!updatedCustomerAccount_cdt.effectiveDate,
                value: local!selectedRows.effectiveDate
              )
              ),
              if(fv!item.accountNum = ri!newAccount_cdt.accountNum,
              a!save(
                target: ri!updatedCustomerAccount_cdt.accountNum, 
                value: ri!newAccount_cdt.accountNum
              ),
              a!save(
                target: ri!updatedCustomerAccount_cdt.accountNum,
                value: local!selectedRows.accountNum
              )
              ),                                  
              a!save(
                target: ri!updatedCustomerAccount_cdt.CustomerId,
                value: local!selectedRows.CustomerId
              ),
              a!save(
                target: ri!updatedCustomerAccount_cdt.aipCode,
                value: ri!newAccount_cdt.aipCode
              )
          },
          required: true()
        ),
e for my dropdown component. All the data that is updated is saved, as expected, except the CustomerId values. The first CustomerId is reflected on pv!updatedCustomerAccount_cdt - for all records updated. If there are 3 records being updated to the new account information - I want the CustomerIds to be the ids associated with the records to be updated. How do I do that? I'm sure I need to include some sort of index on the selected row but I couldn't find anything in the documentation or previous discussions on how to do this. 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Tried another route that worked. I start with a readOnly grid that's selectable - (i.e., the user selects the rows that should be updated to the new account number) - then a second grid displays that is readOnly as well, populated by the selected rows from the first grid. The selected rows displayed in the 2nd grid have the updated account number and today() as the effective date. Since they are readOnly columns - you can't save that data, but I included a series of a!save() lines on the submit button. That worked! Hope this helps someone else!

Reply
  • 0
    Certified Senior Developer

    Tried another route that worked. I start with a readOnly grid that's selectable - (i.e., the user selects the rows that should be updated to the new account number) - then a second grid displays that is readOnly as well, populated by the selected rows from the first grid. The selected rows displayed in the 2nd grid have the updated account number and today() as the effective date. Since they are readOnly columns - you can't save that data, but I included a series of a!save() lines on the submit button. That worked! Hope this helps someone else!

Children
No Data