Hi, I am unable to save my data in the editable grid into the PV. Can

Hi,

I am unable to save my data in the editable grid into the PV. Can you help me out please?

In the interface code:
a!gridLayout(
                                                            headerCells: {
                                                                      a!gridLayoutHeaderCell(label: "Cost Element"),
                                                                      a!gridLayoutHeaderCell(label: "Project Manager"),
                                                                      a!gridLayoutHeaderCell(label: "Split %", align: "RIGHT"),
                                                                      a!gridLayoutHeaderCell(label: "Category Code"),
                                                                      /* For the "Remove" column */
                                                                      a!gridLayoutHeaderCell(label: "")
                                                            },
                                                            /* Only needed when some columns need to be narrow */
                                                            columnConfigs: {
                                                                      a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
                                                                      a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
                                                                      a!gridLayoutColumnConfig(width: "NARROW"),
                                                                      a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
                                                                      a!gridLayoutColumnConfig(width: "NARROW")
                                                            },
                                                            rows: a!applyComponents(
                                                                      function: rule!TRAVEL_SAIL_costElementItemRow(
                                                                                items: local!costElements,
                                                                                index: _,
                    ...

OriginalPostID-184398

OriginalPostID-184398

  Discussion posts and replies are publicly visible

  • ...                                                            itemsToken: local!costElementsList
                                                                          ),
                                                                          array: if(or(isnull(local!costElements), count(local!costElements) < 1), {}, 1+enumerate(count(local!costElements))),
                                                                          arrayVariable: local!costElementsList
                                                                ),
                                                                validations: {
                                                                          /* Check the total amount and show a message immediately */
                                                                          with(
                                                                                    local!total: todecimal(local!costElements.splitPercentage),
                                                                                    if(rule!SI_checkNull(index(local!costElements, "costElementID", "")), null, if(not(local!total = 100),
                                                                                              a!validationMessage( message: "The total of all split percentage must be 100%. It is currently " &
                                                                                              if(rule!SI_checkNull(local!total), 0, local!total) & "%.",validateAfter: "SUBMIT"), null))
                                                                          ),
                                                                          /* Check the # items and show a message on submit */
                                                                          if(rule!SI_checkNotNull(index(local!costElements, "costElementID", "")), null,
                                                                                    a!validationMessage( message: "Please enter at least 1 cost element.",validateAfter: "SUBMIT"))
    ...
  • ...                                                            }
                                                      ),
                                                      a!linkField(
                                                                label: "Add Link",
                                                                labelPosition: "COLLAPSED",
                                                                links: a!dynamicLink(
                                                                          label: "+Add Item",
                                                                          /*
                                                                          * For your use case, set the value to a blank instance of your CDT using
                                                                          * the type constructor, e.g. type!PurchaseRequestItem(). Only specify the field
                                                                          * if you want to give it a default value e.g. due: today()+1.
                                                                          */
                                                                          value: {splitPercentage: null},
                                                                          saveInto: {
                                                                                    a!save(local!costElements, append(local!costElements, save!value)),
                                                                                    /*` When modifying the size of the array used in a!applyComponents, */
                                                                                    /* make the same change in the "token" array variable */
                                                                                    a!save(ri!travelCostElementsList_cdt, append(local!costElementsList, save!value))
                                                                          }
                                                                )
                                                      )

    I am unable to save it into the ri!travelCostElementsList_cdt that will eventually put into the PV that I mentioned. Somewhere that I have missed out??
  • Hi wilt, if possible can you please attach the code for the rule TRAVEL_SAIL_costElementItemRow, which you have been used in the gridlayout. It would be helpful in figure out the issue and solution.
  • Do the below changes, So that the values will store in "travelCostElementsList_cdt" rule input.
    In GridLayout
    items: ri!travelCostElementsList_cdt,

    In link Field
              saveInto: {
                        a!save(ri!travelCostElementsList_cdt, append(ri!travelCostElementsList_cdt, save!value)),
                        a!save(local!costElementsList, append(local!costElementsList, save!value))
                        }
    In your code, the values are local variables. And you are appending
  • 0
    Certified Lead Developer
    Can you verify whether the variable - ri!travelCostElementsList_cdt has grid values by testing in the interface.

    Also as per the below code, grid values are stored in the local variable - local!costElements. We have to store the values in local!costElemets to ri!travelCostElementsList_cdt before submitting the form.
    a!applyComponents(
    function: rule!TRAVEL_SAIL_costElementItemRow(
    items: local!costElements,
    index: _,
    itemsToken: local!costElementsList
    ),
               ....)
  • @Wilt,Before going to PV variable, first check the data is coming to ri!travelCostElementsList_cdt variable.
    If it is fine then create ac!travelCostElementsList_cdt(multiple type) in UIT(User input task) and saveInto pv(multiple) variable.
    while calling these interface rule pass the ac!travelCostElementsList_cdt varible like rule!gridLayoutRule(travelCostElementsList_cdt:ac!travelCostElementsList_cdt)