Hi guys,
I am new to appian, anyone explain this code line by line briefly.
if(rule!AF_RULE_General_isBlank(wherecontains(cons!GCC_DSE_cons_getReadOnlyDrillStatus, tointeger(local!drill.drillStatus))),
remove(local! facilityFloors, wherecontains (false,local! facilityFloors.isActive)),
if(not(rule!AF_RULE_General_isBlank(local!drillfacilityFloors)),
local! drillfacilityFloors,
remove(local!facilityFloors, wherecontains (false,local!facilityFloors.isActive))))
Discussion posts and replies are publicly visible
Hi Vamsi
Firstly, for future reference, please use the "Insert Code" option to include code in your posts as it makes it way easier to read/copy/paste for those of us who are trying to help:
Secondly: the code doesn't look well-formed to me. Pasting it into the Expression Editor it throws a syntax error:
if(rule!AF_RULE_General_isBlank(wherecontains(cons!GCC_DSE_cons_getReadOnlyDrillStatus,tointeger(local!drill.drillStatus))), remove(local! facilityFloors, wherecontains (false,local! facilityFloors.isActive)), if(not(rule!AF_RULE_General_isBlank(local!drillfacilityFloors)), local! drillfacilityFloors, remove(local!facilityFloors, wherecontains (false,local!facilityFloors.isActive))))
Same code, same syntax error
Expression evaluation error: Syntax error. Details: Cannot create an identifier with zero length key:
...that is, this code will never work as it stands.
I think spacing is an issue here.
vamsikrishnac0001
I reformatted the code as follows and added some notes.
Basically it's using a combination of wherecontains which Receives one or more values and returns an array of indices that indicate the position of the values within the array and removes those values
https://docs.appian.com/suite/help/21.4/fnc_array_wherecontains.html
https://docs.appian.com/suite/help/21.4/fnc_array_remove.html
if( /* Checks if local!drillStatus has any values listed from the cons!GCC_DSE_cons_getReadOnlyDrillStatus*/ rule!AF_RULE_General_isBlank( wherecontains( cons!GCC_DSE_cons_getReadOnlyDrillStatus, tointeger(local!drill.drillStatus) ) ), /* If yes (from line 2) then, finds all indexes of items which have local!facilityFloor.isActive = false() and removes them from local!facilityFloors*/ remove( local!facilityFloors, wherecontains(false, local!facilityFloors.isActive) ), /* If no (from line 2)*/ if( not( rule!AF_RULE_General_isBlank(local!drillfacilityFloors) ), /* If local!drillFacilityFloors has any value (not empty), retrun it */ local!drillfacilityFloors, /* Else, finds all indexes of items which have local!facilityFloor.isActive = false() and removes them from local!facilityFloors */ remove( local!facilityFloors, wherecontains(false, local!facilityFloors.isActive) ) ) )
Thank you very much Hrishikesh Dixit for ur time and the answer.
Sorry about that and thank you for ur time.