Expression rule

Certified Associate Developer

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

Parents Reply
  • +1
    Certified Lead Developer
    in reply to Stewart Burchell

    I think spacing is an issue here.

    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)
        )
      )
    )

Children