How do I use a variable from GlobalVars table as the $group?

I have the formula below.

(SUM(r.t30s15 for r in $group 
  if(
    AND(
      r.Dup == False, 
      r.Remove == False, 
      r.Time <=11.3,
      r.w_Fav == True,
      r.w_MACV == True
        )
      )
    ))

It works fine as it’s written, but I would like to be able to change out the “group”

I have a GlobalVars table where I want to store the group to be use.

As an example, I have a “t30s15” group and a “t30s30” group.

I’d like to substitute the hard coded t30s15 with a variable from the GlobalVars table where I can change it in the GlobalVars table from t30s15 to t30s30 and it changes all the formulas on my card

here is an example of all the formulas that use

I tried replacing r.t30s15 with “return GlobalVars.lookupOne().CalcATM”. that gave me an error

I tried “GlobalVars.lookupOne().CalcATM”. that made the field 0.

I’m sure this is doable, but my python knowledge is lacking

thanks for the help

Try replacing r.t30s15 with getattr(r, GlobalVars.lookupOne().CalcATM).

1 Like