Clarification on Expressions Behaviour

Hi All,

I have a confusion on the way expressions work. I have tried to elaborate my confusion, below. Please see if I am clear and if you can guide.

My use-case (This is just example. I have encountered this dilemma quite often).
I want to build a reusable which will be used to send marketing messages to a list of users. Since the list of users can be different in some contexts so I want to have a reusable to which I’ll pass the list of users and send message to those. The reusable also will have different buttons for sending either push notification or Whatsapp message or email notification depending on option selected. I am happy to pass a list expression which would get evaluated in the front-end when it is actually being used

Confusions on expressions
What do expressions mean when they are associated with a group or repeating group as data source or to a reusable as parameter? Are they treated as expressions or actual data inside them?

Question on whether they are treated as dynamic expressions that will keep changing or evaluated once and then used as is while passing as parameter
Especially I have confusion on the expressions that result into a list of things. e.g. search for.... or RG's list of things or Reusable element's list_type_parameter. If I want to pass that expression as the parameter to following, is the expression passed or whole result of the expression?

  • Parameter to a reusable element
  • Parameter to display list in an RG
  • Parameter to a ‘schedule API’ call
  • Parameter to a custom event

If whole result, then will it become very expensive and slow to have reusables which have list parameters? How do we build such reusables then? (Referring to my example given above)

If passed as expression, then does the list get updated as and when results of expressions change? (Applicable only to first two bullet points in my list above I guess)

Question on reusing of those expressions and data sources within a page or reusable
So in my example of reusable for marketing message, I want to display the count of users to whom the message will be sent. Similarly, there are buttons which send either push notification or Whatsapp message or email notification depending on option used.

Now each of those buttons have separate workflows which use Reusable's list_type_parameter or RG's list of things as I do not want to write same search for... expression again and again for ease of maintenance of code.

Now question is, when I do that,

  • Will I end up recalculating the list again and again?
  • Will I end up spending WUs again and again?
  • Will I pass big lists around make whole thing very slow?