I am using an apply function to build SAIL components based on an array of data(

Certified Lead Developer
I am using an apply function to build SAIL components based on an array of data(CDT).

Now that I have upgraded to 7.4 I plugged in the new integerField but receive the following error:

"The load function cannot be used within rules called by looping functions. Instead, pass the necessary variables via rule inputs. Load variables found: local!textValue, local!setIfTextIsNotValid, local!validationFunction, local!validations."

I do not use load() in the rule that creates the SAIL elements and the local! variables listed as being found do not appear anywhere in any of my expressions. I get the same error whilst trying to use dateTimeField - is there something different or restrictive about the new components?...

buildSAILcomponents.txt

OriginalPostID-96067

OriginalPostID-96067

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    Ok thanks for the pointer. This has broken all of the saveInto parameters. I'm passing in a CDT array but how can I save back into ri!cdt.value as I've lost control of the index
  • Take a look at this recipe on how to add and populate sections dynamically: forum.appian.com/.../SAIL_Recipes

    It uses a!applyComponents to return SAIL sections, and also shows how you update fields of a CDT within each section.
  • FYI, I have a rule that calls some functions using the load() and I can confirm that it runs fine on 7.2 and fails on 7.4. This is on a standard portal based model that never touches Tempo or SAIL.
  • Ryan, that shouldn't happen. Can you attache a copy of the rule here and if it's not something that I can execute on a clean environment a better description of what "fails" means? A screenshot or the exact error message would help.
  • I've found multiple references in the forums & release notes to the load() function not working anymore in 7.3/7.4 in certain looping functions. "You cannot use this function within the Web Content Channel or a Looping Function or else an error occurs."

    Alert error:

    There is a problem with task “Update Days In Process” in the process “ARG: Dev: Update Days in Process - ELAR # 90319”. ERROR:An error occurred while evaluating expression: =if(isnull(apply(rule!roundDurationToDaysBase24,apply(rule!calculateHoldDurationForCollateralService,pv!theCollaterals_ArgCollaterals.collateralId_Int))),0,apply(rule!roundDurationToDaysBase24,apply(rule!calculateHoldDurationForCollateralService,pv!theCollaterals_ArgCollaterals.collateralId_Int))) (Expression evaluation error at function 'apply': Error evaluating function 'apply' : Expression evaluation error in rule 'calculateholddurationforcollateralservice': The load function cannot be used within rules called by looping functions. Instead, pass the necessary variables via rule inputs. Load variables found: local!collateralId, local!arrayOfPlaceOnHoldEvents, local!arrayOfTakeOffHoldEvents.) (Data Inputs)


    Here is the primary function in question:

    =if(isnull(apply(rule!roundDurationToDaysBase24,apply(rule!calculateHoldDurationForCollateralService,pv!theCollaterals_ArgCollaterals.collateralId_Int))),0,apply(rule!roundDurationToDaysBase24,apply(rule!calculateHoldDurationForCollateralService,pv!theCollaterals_ArgCollaterals.collateralId_Int)))

    roundDurationToDaysBase24 = Derives the integer number of days from a duration-type object. Will the number of days up if hours component of duration is greater than or equal to 12.
    = if(isnull(ri!duration),0,tointeger(ri!duration)+if((hour(ri!duration))>=12,1,0))

    calculateHoldDurationForCollateralService = Returns the total duration (may be sum of several different periods) for which a specific collateral service (identified by parameter collateralId_int) has had the status of "On Hold".

    =load(
    local!collateralId:ri!collateralId_int,
    local!arrayOfPlaceOnHoldEvents: rule!getOnHoldEventsForCollateralService(local!collateralId).timestamp_datetime,
    local!arrayOfTakeOffHoldEvents: rule!getHoldReleaseEventsForCollateralService(local!collateralId).timestamp_datetime,
    if(
                        or(
                                  length(local!arrayOfPlaceOnHoldEvents)<1,
                                  isnull(local!arrayOfPlaceOnHoldEvents)
                                  ),
                        0,
                        if(
                                  length(local!arrayOfPlaceOnHoldEvents)=length(local!arrayOfTakeOffHoldEvents),
                                  reduce(rule!sumDurations,now()-now(),apply(rule!calculateDuration,merge(local!arrayOfPlaceOnHoldEvents,local!arrayOfTakeOffHoldEvents))),
                                  reduce(rule!sumDurations,now()-now(),apply(rule!calculateDuration,merge(local!arrayOfPlaceOnHoldEvents,append(local!arrayOfTakeOffHoldEvents,now()))))
                                  )
                        )
              )
  • load() only has special behavior within a SAIL UI. For expressions that you use elsewhere, use with(), which can be used within looping functions.