Hi, I have created a grid using a interface, and when I am trrying to sort

Hi,
I have created a grid using a interface, and when I am trrying to sort the grid by clicking on the header cell, it gives me an error as fllows:

Interface Definition: Expression evaluation error: An error occurred while executing a save: Expression evaluation error: The save target must be a load() variable, process variable, or node input (or a rule input passed one of those three), but instead was: [startIndex=1, batchSize=-1, sort=]

Following is code snippet for the interface.

with(
local!pagingInfo: a!pagingInfo(1, -1),
local!deal: rule!ICAMS_getDealById(id: ri!dealId),
local!supplier: if(
/* RIM deals have blank supplier ID */
rule!APN_isBlank(local!deal.supplierId),
{},
rule!ICAMS_getSupplierById(local!deal.supplierId)
),
local!modules: rule!ICAMS_getDealModuleViewByDealIdAndActiveFlag(
dealId: ri!dealId,
pagingInfo: local!pagingInfo,
activeFlag: true,
selection: rule!ICAMS_querySelectionForAcq...

OriginalPostID-199415

OriginalPostID-199415

  Discussion posts and replies are publicly visible

  • ...uisitionSheet()
    ),
    a!dashboardLayout(
    firstColumnContents: {
    a!sectionLayout(
    firstColumnContents: {
    if(rule!APN_isBlank(index(local!supplier, "supplierName", null)), {},
    a!textField(
    label: "Supplier",
    labelPosition: "ADJACENT",
    value: index(local!supplier, "supplierName", null),
    readOnly: true
    )
    ),
    a!textField(
    label: "Start Date",
    labelPosition: "ADJACENT",
    value: local!deal.createdDate,
    saveInto: local!deal.createdDate,
    readOnly: true
    ),
    a!textField(
    label: "Deal Type",
    labelPosition: "ADJACENT",
    value: local!deal.dealType,
    saveInto: local!deal.dealType,
    readOnly: true
    )
    }
    ),
    a!sectionLayout(
    ...
  • ...label: "Modules",
    firstColumnContents: {
    a!gridField(
    totalCount: count(local!modules),
    columns: {
    a!gridTextColumn(label: "Module Type", field: "platform", data: index(local!modules, "platform",{} )),
    a!gridTextColumn(label: "S/N", field: "serialNumber", data: index(local!modules, "serialNumber",{} )),
    a!gridTextColumn(label: "Target Value", field: "targetPrice", data: index(local!modules, "targetPrice",{} )),
    a!gridTextColumn(label: "Purchase Value", field: "purchaseValue", data: index(local!modules, "purchaseValue",{} )),
    a!gridTextColumn(label: "Audited Value", field: "fieldAuditDeduction", data: apply(rule!ICAMS_calculateAuditValueForAcquisitionSummary, local!modules)),
    a!gridTextColumn(label: "Freight Allocation", field: "purchaseValue", data: apply(rule!ICAMS_getShippingPriceForModule, local!modules)),
    a!gridTextColumn(la...
  • ... bel: "Total Cost", field: "purchaseValue", data: apply(rule!ICAMS_calculateStandardCost, local!modules)),
    a!gridTextColumn(label: "Part Number", field: "newPartNumber", data: index(local!modules, "newPartNumber",{} )),
    a!gridTextColumn(label: "Info Record", field: "infoRecord", data: index(local!modules, "infoRecord",{} )),
    a!gridTextColumn(label: "SAP SLOC", field: "sapsLocation", data: index(local!modules, "sapsLocation",{} )),
    a!gridTextColumn(label: "PO#", field: "purchaseOrderNo", data: index(local!modules, "purchaseOrderNo",{} )),
    a!gridTextColumn(label: "RAM#", field: "ramNo", data: index(local!modules, "ramNo",{} )),
    a!gridTextColumn(label: "Book Value", field: "purchaseValue", data: apply(rule!APN_dollar(_, false), index(local!modules, "stdCost", {})))

    },
    value: local!pagingInfo,
    saveInto: local!pagingInfo
    )
    ...
  • ... }
    ),
    a!sectionLayout(
    firstColumnContents: {},
    secondColumnContents: {
    a!gridField(
    totalCount: 1,
    columns: {

    a!gridTextColumn(label: "Total Target Value", field: "targetPrice", data: sum(index(local!modules, "targetPrice", 0))),
    a!gridTextColumn(label: "Total Purchase Value", field: "purchaseValue", data: sum(index(local!modules, "purchaseValue", 0))),
    a!gridTextColumn(label: "Total Audited Value", field: "totalAuditedValue", data: rule!ICAMS_getSumAuditedValue(local!modules)),
    a!gridTextColumn(label: "Total Freight Allocation", field: "totalFreightAllocation", data: rule!ICAMS_getSumFreightAllocation(local!modules)),
    a!gridTextColumn(label: "Total Cost", field: "totalSAPstdCost", data: rule!ICAMS_getSumSAPStandardCost(local!modules)),
    a!gridTextColumn(label: "Total Book Value", field: "totalSAPs...
  • ... tdCost", data: sum(index(local!modules, "stdCost", {})))

    },
    value: a!pagingInfo(1,-1)
    )
    }
    )
    }
    )
    )


    Is it because my a!sectionLayout is saving paginginfo at the end? Kindly suggest.
  • Hi Sailesh,
    You are getting this error as the local!pagingInfo is placed inside with(), always use a load variable for saving values as with() variables are reset each evaluation and cannot be used as save targets.
    Check the documentation for more information :
    forum.appian.com/.../Evaluation_Functions.html
  • @saileshd The suggestion made by the practitioner above should be also applied for the following variable:

    local!deal: rule!ICAMS_getDealById(id: ri!dealId), (local!deal, a variable defined in with() at line#4, is being used in 'saveInto' at line#33 and line#40)