Skip to main content
nick.fleming
May 13, 2021
Question

load() function causing error when it is not used

  • May 13, 2021
  • 12 replies
  • 0 views

I got this error when none of the interfaces or expression rules mentioned use the load() function, they all use a!localVariables(). Does anyone know why this error could still be appearing?

"Interface Definition: Expression evaluation error ... The load() function cannot be used within rules called by looping functions other than a!forEach(). Pass the necessary variables via rule inputs or use a!forEach()."

12 replies

mikes0011
Brainy
May 13, 2021

Can you perhaps provide some more detail about a rule that's experiencing this?  Is it happening in cases where there's a big nested hierarchy, or in relatively simple rules too?

The Expression Guru
csteward
May 13, 2021

You know, I have seen this error before but haven't been able to replicate (or find) today.  My setup did not contain any load() calls either, however little jostling of the code got rid of it.  Very interested for a code snippet if you can provide, and I wouldn't be surprised if we could dig a bug out..

mikes0011
Brainy
May 14, 2021

Now that I think more on it, I think I may have seen behavior like this once when there was a localVariable configured to have "refreshOnReferencedVarChange" turned off (which makes it essentially like a load() variable)... of course I have no proof of this.

The Expression Guru
csteward
May 14, 2021

Yea, it is definitely something in that realm..  I can't seem to reproduce however, will need that code snippet to identify..

richardm900458
May 14, 2021

just as basic idea: does any of your called expression rules or interface components have any load? 

alex.ladue
May 14, 2021

This is a bad error message, but I'm pretty sure the cause of it is usually using the function a!forEach inside of another looping function like reduce(). Any chance you are doing that?

nileshr5443
January 12, 2023

Yes exactly the same I am doing using a!foreach inside reduce fn. At expression rule level it is working fine but as soon as I implement it to main rules it is giving error on UI. So any solution for it to overcome this issue. I tried using a!refreshvariable and refreshalways as true but sill same issue.

Any help would be appreciated

alex.ladue
January 12, 2023

a!forEach unfortunately cannot be used inside of reduce. Instead of a!forEach, you'll have to use fn!apply(),