Hi,
I'm getting below error with the below code. Please help me in resolving this
a!localVariables( local!selection, local!selectedProduct, local!rowSelectionIndex, local!docCodes, local!removedPropertiesList, local!finalNotificationProperty:a!refreshVariable( value:ri!finalNotificationProperty ), local!removedPropertyIdList:a!refreshVariable( value:ri!removedPropertyIdList ), local!documentCodes, /*local!tempDate,*/ a!sectionLayout( label: "Product Details", contents: { a!gridField( label: "Read-only Grid", labelPosition: "COLLAPSED", data: ri!finalNotificationProductDetails, columns: { a!gridColumn( label: "MK/V", value: fv!row.mkv_txt ), a!gridColumn( label: "Generic Name", value: fv!row.genericName_txt ), a!gridColumn( label: "Trade Name", value: fv!row.tradeName_txt ), a!gridColumn( label: "Last Lot Expiry Date", value: rule!RGRACSLBL_merckDateFormat( fv!row.lastLotExpiryDate_dt ) ), a!gridColumn( label: "Document Code(s)", value: index( index( local!finalNotificationProperty, "pickListValue_txt", {} ), wherecontains( tointeger( fv!row.id_int ), tointeger( index( local!finalNotificationProperty, "finalNtifctnProductDetailsId_int", {} ) ) ) ) ) }, pageSize: 5, selectable: true(), selectionStyle: "ROW_HIGHLIGHT", selectionValue: local!selection, selectionSaveInto: { local!selection, a!save( local!selectedProduct, fv!selectedRows ) }, disableRowSelectionWhen: or(if( rule!APN_isBlank( local!selection ), false(), length( local!selection ) = 1 ), ri!addProduct="Add Product" ) ), a!buttonLayout( primaryButtons: { a!buttonWidget( label: cons!RGRACSLBL_UA_REMOVE, value: local!selectedProduct.id_int, saveInto: { a!save( ri!finalNotificationProductDetails, remove( ri!finalNotificationProductDetails, wherecontains( index( local!selectedProduct, "id_int", 0 ), ri!finalNotificationProductDetails.id_int ) ) ), a!save( ri!productDetailsOld, remove( ri!productDetailsOld, wherecontains( index( local!selectedProduct, "id_int", 0 ), ri!productDetailsOld.id_int ) ) ), a!save( ri!removedProductIdList, append( ri!removedProductIdList, local!selectedProduct.id_int ) ), a!save( local!removedPropertyIdList, append( local!removedPropertyIdList, index( index( local!finalNotificationProperty, "id_int", {} ), wherecontains( tointeger( local!selectedProduct.id_int ), tointeger( index( local!finalNotificationProperty, "finalNtifctnProductDetailsId_int", {} ) ) ) ) ) ), a!save(ri!removedPropertyIdList, local!removedPropertyIdList), a!save( local!finalNotificationProperty, remove( local!finalNotificationProperty, wherecontains( local!selectedProduct.id_int, local!finalNotificationProperty.finalNtifctnProductDetailsId_int ) ) ), a!save( ri!finalNotificationProperty, local!finalNotificationProperty ), a!save( { local!selectedProduct, local!selection, local!rowSelectionIndex }, null ) }, style: "DESTRUCTIVE", disabled: or( rule!APN_isBlank( local!selectedProduct ), ri!addProduct = "Edit Product" ), confirmMessage: "Are you sure you wish to delete the selected product(s)?", confirmButtonLabel: "Yes", cancelButtonLabel: "No" ), a!buttonWidget( label: cons!RGRACSLBL_UA_EDIT, value: "Edit Product", saveInto: { ri!addProduct, a!save( ri!documentCodeSemiColonSeparated, index( local!finalNotificationProperty.pickListValue_txt, wherecontains( tointeger( local!selectedProduct.id_int ), local!finalNotificationProperty.finalNtifctnProductDetailsId_int ) ) ), a!save(local!docCodes,tostring(ri!documentCodeSemiColonSeparated)), a!save( ri!productDetailsToAdd, local!selectedProduct ), a!save( local!rowSelectionIndex, local!selection ) }, size: "STANDARD", disabled: or( ri!addProduct="Edit Product", rule!APN_isBlank( local!selectedProduct) ) ), a!buttonWidget( label: "Add Product", value: "Add Product", saveInto: { ri!addProduct, a!save( ri!productDetailsToAdd.id_int, if( rule!APN_isBlank( ri!finalNotificationProductDetails ), - 1, - ( length( ri!finalNotificationProductDetails.id_int ) + 1 ) ) ) }, size: "STANDARD", disabled: or( ri!addProduct = "Add Product", not(rule!APN_isBlank( local!selectedProduct ))) ) }, secondaryButtons: a!buttonWidget( label: "clear selection", value: null, saveInto: { local!selection, local!selectedProduct, local!rowSelectionIndex }, disabled: or( ri!addProduct = "Edit Product", rule!APN_isBlank( local!selection ) ) ) ), if( or( ri!addProduct = "Add Product", ri!addProduct = "Edit Product" ), { rule!RGRACSLBL_addFinalCCNProductDetails( mkv: ri!productDetailsToAdd.mkv_txt, tradeName: ri!productDetailsToAdd.tradeName_txt, genericName: ri!productDetailsToAdd.genericName_txt, documentCodeSemiColonSeparated: ri!documentCodeSemiColonSeparated, expiryDate: ri!productDetailsToAdd.lastLotExpiryDate_dt, readOnly: false, propertyUpdated: ri!propertyUpdated ), if( ri!addProduct = "Add Product", if( rule!RGRACSLBL_checkForDuplicateTradeName( productsList: if( rule!APN_isBlank( local!rowSelectionIndex ), ri!finalNotificationProductDetails, remove( ri!finalNotificationProductDetails, local!rowSelectionIndex ) ), productToAdd: ri!productDetailsToAdd ), a!richTextDisplayField( labelPosition: "COLLAPSED", value: a!richTextItem( text: cons!RGRACSLBL_TEXT_VALIDATION_MSG[11], color: "NEGATIVE" ) ), {} ), {} ), a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Save", saveInto: { if( ri!addProduct = "Add Product", a!save( ri!finalNotificationProductDetails, append( ri!finalNotificationProductDetails, ri!productDetailsToAdd ) ), a!save( ri!finalNotificationProductDetails, updatearray( ri!finalNotificationProductDetails, tointeger( local!selection ), ri!productDetailsToAdd ) ) ), if( ri!addProduct = "Add Product", a!save( ri!productDetailsOld, append( ri!productDetailsOld, ri!productDetailsToAdd ) ), a!save( ri!productDetailsOld, updatearray( ri!productDetailsOld, tointeger( local!selection ), ri!productDetailsToAdd ) ) ), a!save( local!documentCodes, a!flatten( a!forEach( items: split( ri!documentCodeSemiColonSeparated, ";" ), expression: trim( fv!item ) ) ) ), a!save( local!documentCodes, remove( local!documentCodes, wherecontains( null, local!documentCodes ) ), ), a!localVariables( local!ccnProperty: a!forEach( items: local!documentCodes, expression: 'type!{urn:com:appian:types:RGRACSLBL}RGRACSLBL_finalNotificationProperty'( id_int: if( rule!APN_isBlank( local!finalNotificationProperty ), - 1, - ( length( local!finalNotificationProperty ) + fv!index ) ), finalNtifctnProductDetailsId_int: ri!productDetailsToAdd.id_int, pickList_txt: cons!RGRACSLBL_PICKLIST_TYPES[2], pickListValue_txt: fv!item, createdBy_txt: loggedInUser(), createdAt_dt: now(), updatedAt_dt: now(), updatedBy_txt: loggedInUser() ) ), { if( ri!addProduct = "Edit Product", if(local!docCodes=ri!documentCodeSemiColonSeparated,{}, { a!save( local!removedPropertiesList, append( local!removedPropertiesList,index(local!finalNotificationProperty, wherecontains( tointeger( local!selectedProduct.id_int ), local!finalNotificationProperty.finalNtifctnProductDetailsId_int ) ,{}) ) ), a!save(ri!removedPropertyIdList, append(ri!removedPropertyIdList, local!removedPropertiesList.id_int)), a!save( local!finalNotificationProperty, remove( local!finalNotificationProperty, wherecontains( tointeger( local!selectedProduct.id_int ), local!finalNotificationProperty.finalNtifctnProductDetailsId_int ) ) )}), {} ), if(and(ri!addProduct="Edit Product" , local!docCodes=ri!documentCodeSemiColonSeparated),{}, a!save( local!finalNotificationProperty, append( local!finalNotificationProperty, local!ccnProperty ) )), } ), a!save( ri!finalNotificationProperty, local!finalNotificationProperty ), a!save( { ri!addProduct, ri!productDetailsToAdd, ri!documentCodeSemiColonSeparated, local!docCodes, local!documentCodes }, null ), a!save( { local!selectedProduct, local!selection }, null ) }, style: "PRIMARY", disabled: if( ri!addProduct = "Add Product", rule!RGRACSLBL_checkForDuplicateTradeName( productsList: if( rule!APN_isBlank( local!rowSelectionIndex ), ri!finalNotificationProductDetails, remove( ri!finalNotificationProductDetails, local!rowSelectionIndex ) ), productToAdd: ri!productDetailsToAdd ), false() ), validate: true() ) }, secondaryButtons: { a!buttonWidget( label: "Cancel", saveInto: { a!save( { ri!addProduct, ri!productDetailsToAdd, ri!documentCodeSemiColonSeparated }, null ), a!save( { local!selectedProduct, local!selection, local!rowSelectionIndex }, null ) } ) } ) }, {} ) } ) )
Discussion posts and replies are publicly visible
Could it be that this error is in the rule input test values?
Yes, as Stefan mentioned it is the issue with values you're passing. It is not matching the index in the rule expression.
I am passing below code as input for finalnotificationproductdetails. Please help me in resolving this error
rule!RGRACSLBL_QE_getFinalNotificationProducts ( finalNotificationDetailsId: rule!RGRACSLBL_QE_getDataForFinalNotificationRequests( mkv: "MK-0431", pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 1 ) ).data.final_ntifctn_details_id_int ).data
In case that inner query does not return any data, the indexing in line 9 will throw that exact error message.
Try using index() or property() function instead of dot notation and it should be solved.
Try this...index( rule!RGRACSLBL_QE_getFinalNotificationProducts( finalNotificationDetailsId: index( rule!RGRACSLBL_QE_getDataForFinalNotificationRequests( mkv: "MK-0431", pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 1) ), "data", "final_ntifctn_details_id_int", {} ) ), "data", {})