Hi all,
My older version code uses executesqlQuery to execute a SQL code and it returns dictionary value . They used the rule in main interface to save the values to local variables. Now the function is deprecated and we replace it with executeStoredProcedureForQuery to execute SQL and it returns Map structure. But we are getting error while saving that in the main interface.
This is the error we are getting. I have changed the index value as the new structure but still I am getting error. Anyone have idea about how to resolve that?
Thanks,
Kavya
Discussion posts and replies are publicly visible
Can you share the affected code snippet?
Hi Stefan,
I can't able to share my code, It was marking as spam.
a!buttonWidget( label: "Search", style: "NORMAL", value: true, saveInto: { local!search, if( local!refreshSearch, if( local!tabNbr = cons!GOS_ORDER_SEARCH_TAB_RESTRICT, { a!save(ri!gridAvailData, null), a!save(ri!summaryDs, null) }, if( local!tabNbr = cons!GOS_ORDER_SEARCH_TAB_DETAILS, { a!save(ri!gridRestrictData, null), a!save(ri!summaryDs, null) }, if( local!tabNbr = cons!GOS_ORDER_SEARCH_TAB_SUMMARY, { a!save(ri!gridAvailData, null), a!save(ri!gridRestrictData, null), }, {} ) ) ), {} ), { a!save(ri!generatedDocument, null), a!save( local!countRecognizedIds, index(index(index( rule!GOS_getRefBatchOrCpdMetadataByFieldAndValueSQL( fieldName: index( ri!browseInventoryHelper, "searchIdField", {} ), fieldValues: local!searchIdValues, getCountOnly: true ), "parameters",{} ),"SQLOUTPUT_CURSOR",{}),"COUNT",{}) ), a!save( local!restrictData, index(index( rule!GOS_getBatchRestrictionsBySearchValuesSQL( searchFieldId: index( ri!browseInventoryHelper, "searchIdField", {} ), searchValues: index( ri!browseInventoryHelper, "searchIdValue", {} ), getCountOnly: false, getBatIdentifierOnly: false, requester: loggedInUser(), notificationTab: false(), stateId: index( ri!browseInventoryHelper, "searchStateId", {} ) ), "parameters",{} ),"SQLOUTPUT_CURSOR",{}) ), a!save( local!notificationData, index(index( rule!GOS_getBatchRestrictionsBySearchValuesSQL( searchFieldId: index( ri!browseInventoryHelper, "searchIdField", {} ), searchValues: index( ri!browseInventoryHelper, "searchIdValue", {} ), getCountOnly: false, getBatIdentifierOnly: false, requester: loggedInUser(), notificationTab: true(), stateId: index( ri!browseInventoryHelper, "searchStateId", {} ) ), "parameters",{} ),"SQLOUTPUT_CURSOR",{}) ), a!save( local!restrictGridSelection.startIndex, 1 ), a!save( local!notificationGridSelection.startIndex, 1 ), a!save( ri!gridRestrictData, rule!GOS_setRestrictionsFromSQL(local!restrictData) ), a!save( ri!gridNotificationData, rule!GOS_setRestrictionsFromSQL(local!notificationData) ), a!save(local!viewAllIds, false), a!save(local!searchUnavail, false), a!save(local!isSummaryView, false), if( local!isRestrictionSearch, { a!save( local!currentDataTabs, cons!GOS_ORDER_SEARCH_TAB_RESTRICT ), a!save( local!restrictData, index(index( rule!GOS_getBatchRestrictionsBySearchValuesSQL( searchFieldId: index( ri!browseInventoryHelper, "searchIdField", {} ), searchValues: local!searchIdValues, getCountOnly: false, getBatIdentifierOnly: false, requester: loggedInUser(), notificationTab: false(), stateId: index( ri!browseInventoryHelper, "searchStateId", {} ) ), "parameters",{} ),"SQLOUTPUT_CURSOR",{}) ), a!save( local!restrictGridSelection.startIndex, 1 ), a!save( ri!gridRestrictData, rule!GOS_setRestrictionsFromSQL(local!restrictData) ), a!save( local!batchRestrictData, index( rule!GOS_getBatchRestrictionsBySearchValues( searchFieldId: "batIdentifier", searchValues: index(ri!gridRestrictData, "batIdentifier", {}), pagingInfo: a!pagingInfo(startIndex:1, batchSize:- 1, sort:{}), stateId: index( ri!browseInventoryHelper, "searchStateId", {} ), getCountOnly: false, getBatIdentifierOnly: false ), "data", {} ) ), if( rule!APN_isEmpty(ri!gridRestrictData), {}, { a!save( ri!gridRestrictData.startDate, index(local!batchRestrictData, "startDate", {}) ), a!save( ri!gridRestrictData.endDate, index(local!batchRestrictData, "endDate", {}) ) } ), a!save( local!countRestricted, if( rule!APN_isEmpty(ri!gridRestrictData), 0, index(index(index( rule!GOS_getBatchRestrictionsBySearchValuesSQL( searchFieldId: index( ri!browseInventoryHelper, "searchIdField", {} ), searchValues: local!searchIdValues, getCountOnly: true, getBatIdentifierOnly: false, requester: loggedInUser(), stateId: index( ri!browseInventoryHelper, "searchStateId", {} ) ), "parameters",{} ),"SQLOUTPUT_CURSOR",{}),"COUNT",{}) ) ) }, if( local!isNotificationSearch, { a!save( local!currentDataTabs, cons!GOS_ORDER_SEARCH_TAB_NOTIFICATION ), a!save( local!notificationData, index(index( rule!GOS_getBatchRestrictionsBySearchValuesSQL( searchFieldId: index( ri!browseInventoryHelper, "searchIdField", {} ), searchValues: local!searchIdValues, getCountOnly: false, getBatIdentifierOnly: false, requester: loggedInUser(), notificationTab: true(), stateId: index( ri!browseInventoryHelper, "searchStateId", {} ) ), "parameters",{} ),"SQLOUTPUT_CURSOR",{}) ), a!save( local!notificationGridSelection.startIndex, 1 ), a!save( ri!gridNotificationData, rule!GOS_setRestrictionsFromSQL(local!notificationData) ), a!save( local!batchRestrictData, index( rule!GOS_getBatchRestrictionsBySearchValues( searchFieldId: "batIdentifier", searchValues: index( ri!gridNotificationData, "batIdentifier", {} ), pagingInfo: a!pagingInfo(startIndex:1, batchSize:- 1, sort:{}), stateId: index( ri!browseInventoryHelper, "searchStateId", {} ), getCountOnly: false, getBatIdentifierOnly: false ), "data", {} ) ), if( rule!APN_isEmpty(ri!gridNotificationData), {}, { a!save( ri!gridNotificationData.startDate, index(local!batchRestrictData, "startDate", {}) ), a!save( ri!gridNotificationData.endDate, index(local!batchRestrictData, "endDate", {}) ) } ), a!save( local!countNotification, if( rule!APN_isEmpty( rule!GOS_setRestrictionsFromSQL(local!notificationData) ), 0, index(index(index( rule!GOS_getBatchRestrictionsBySearchValuesSQL( searchFieldId: index( ri!browseInventoryHelper, "searchIdField", {} ), searchValues: local!searchIdValues, getCountOnly: true, getBatIdentifierOnly: false, requester: loggedInUser(), notificationTab: true(), stateId: index( ri!browseInventoryHelper, "searchStateId", {} ) ), "parameters",{} ),"SQLOUTPUT_CURSOR",{}),"COUNT",{}) ) ) }, { a!save( local!tabNbr, cons!GOS_ORDER_SEARCH_TAB_DETAILS ), a!save( local!currentDataTabs, cons!GOS_ORDER_SEARCH_TAB_DETAILS ), a!save( local!gridAvailSelection, local!gridAvailPagingDefault ), local!sqlResult: index(index( rule!GOS_getRefBatchesToSearchBeforeCreationSQL( isExport: true, idField: index( ri!browseInventoryHelper, "searchIdField", {} ), idValue: local!searchIdValues, siteId: index( ri!browseInventoryHelper, "searchSiteIds", {} ), solventId: index( ri!browseInventoryHelper, "searchSolventIds", {} ), stateId: index( ri!browseInventoryHelper, "searchStateId", {} ), minAmount: local!minSearchAmtStd, minConcentration: if( and( not( rule!APN_isBlank( index( ri!browseInventoryHelper, "minConcentration", {} ) ) ), index( ri!browseInventoryHelper, "minConcentration", {} ) <> local!minSearchConcStd ), index( ri!browseInventoryHelper, "minConcentration", {} ), local!minSearchConcStd ), available: true, isSolidOrderType: local!isSolidOrderType, maxAmount: if( or( rule!APN_isBlank(local!maxSearchAmtStd), local!maxSearchAmtStd = 0 ), null, local!maxSearchAmtStd ), maxConcentration: if( or( rule!APN_isBlank(local!maxSearchConcStd), local!maxSearchConcStd = 0 ), null, local!maxSearchConcStd ), oldestSynthDate: index( ri!browseInventoryHelper, "oldestSynthesisDate", {} ), newestSynthDate: index( ri!browseInventoryHelper, "newestSynthesisDate", {} ), chemistName: index( ri!browseInventoryHelper, "chemistName", {} ), minMw: index(ri!browseInventoryHelper, "minMw", {}), maxMw: if( or( rule!APN_isBlank( index(ri!browseInventoryHelper, "maxMw", {}) ), index(ri!browseInventoryHelper, "maxMw", {}) = 0 ), null, index(ri!browseInventoryHelper, "maxMw", {}) ), origin: index(ri!browseInventoryHelper, "origin", {}), concUnit: if( or( index( ri!browseInventoryHelper, "concUnits", {} ) = cons!GOS_REF_UNIT_CONCENTRATION_MGML, index( ri!browseInventoryHelper, "concUnits", {} ) = cons!GOS_REF_UNIT_CONCENTRATION_MM ), index( rule!GOS_getConcUnitIdByConcUnit(ri!browseInventoryHelper.concUnits), "description", {} ), {} ), ), "parameters",{} ),"SQLOUTPUT_CURSOR",{}), local!sqlData: rule!GOS_setRefInvFromSQL(local!sqlResult), a!save(ri!gridAvailData, local!sqlData), a!save( local!countRestricted, index(index(index( rule!GOS_getBatchRestrictionsBySearchValuesSQL( searchFieldId: index( ri!browseInventoryHelper, "searchIdField", {} ), searchValues: local!searchIdValues, getCountOnly: true, getBatIdentifierOnly: false, requester: loggedInUser(), notificationTab: false(), stateId: index( ri!browseInventoryHelper, "searchStateId", {} ) ), "parameters",{} ),"SQLOUTPUT_CURSOR",{}),"COUNT",{}) ), a!save( local!countNotification, index(index(index( rule!GOS_getBatchRestrictionsBySearchValuesSQL( searchFieldId: index( ri!browseInventoryHelper, "searchIdField", {} ), searchValues: local!searchIdValues, getCountOnly: true, getBatIdentifierOnly: false, requester: loggedInUser(), notificationTab: true(), stateId: index( ri!browseInventoryHelper, "searchStateId", {} ) ), "parameters",{} ),"SQLOUTPUT_CURSOR",{}),"COUNT",{}) ) } ) ) }, a!save(local!refreshSearch, false) }, disabled: or( rule!APN_isBlank(local!searchIdValues), and( not( rule!APN_isBlank(local!prelimSearchIdValues) ), rule!APN_isBlank(local!searchIdValues) ), and(local!anyStateFilterCorrect), if( not( rule!APN_isBlank(local!searchIdValuesRaw) ), false, or( if( rule!APN_isBlank(local!searchIdValues), true, false ), and( local!tabNbr = 2, or(rule!APN_isEmpty(local!searchIdValues)) ) ) ) ), submit: false, validate: true, validationGroup: "searchButton" )
I have tried this also, Still could'nt post the code.
A screenshot?
Initially the sub rule gives map structure , Now I used a!toJson and a!fromJson to convert that to dictionary format. Still the error happens at save function.
Can you try to use proper keyword syntax like below.
a!save( target: local!something, value: rule!something() )
there you have a!saves() and local variable declaration in a saveinto?
any deeper sense, which I might miss for this kind of {}-structure in the saving logic?
small hint:you dont need the if at line 530. just rule!apn_isblank is enough.in line 522 you don't need the and()
Richard Michaelis said:there you have a!saves() and local variable declaration in a saveinto?
Yes, this will cause the issue. The local variable declarations in saveInto should also be wrapped in a!save() instead, such as here:
And here:
You can replicate this error by trying this in a simple interface:
a!localVariables( local!buttonVal, a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Save", saveInto: { a!save(local!buttonVal,"test"), local!test: a!map(id: 1) /* This line is not correct! */ } ) } ) )
To add to the thread this error also will occur for the situation where you have a rule input defined as an expression, not a variable. Such as an a!save(ri!value,"test"), where the input definition in the user input task is something like a string "value here", vs a variable such as pv!value.
this looks familiar, lol...
Mike Schmitt said:this looks familiar, lol...
Ha, oops! But I agree!