Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Evaluate within a recursive CF

Featured Replies

Hi Guys,

Just having some problems.

I'm trying to evaluate an expression that is based on

The CF

Paramaters: FieldListSeperatedByPipe ; CustomExpression ; n ; total

FieldListSeperatedByPipe is just that

The CustomExpression is meant to be a case statement that references currentField, but that's the bit i can't get to work.

Let([ 

	n = If(IsEmpty(n) ; 1 ; n ) ;

	list = Substitute(FieldListSeperatedByPipe ; "|" ; ¶ ) ;

	y = ValueCount( list ) ;

	currentField = GetField(GetValue( list ; n )) ;

	z = Sum(Evaluate(CustomExpression); total )



];

If( n < y ; 	SumConditionalFieldsCustomExpression( FieldListSeperatedByPipe ; CustomExpression ; n + 1 ; z ) 	; z )



)//End of Let




Usage Attempt


SumConditionalFieldsCustomExpression( "temp::field1|temp::field2|temp::field3|temp::field4" ; "Case(currentField = "Yes" ; 3 ; CurrentField = "No" ; 1 )"  ;  "" ; "" )

See the attached file as well. It's not really important, and it's actually some one elses scenario, but i'm just trying to work out why evaluate won't work for future reference.

Cheers

temp.zip

The Evaluate() function starts a new variable scope, and it cannot see local variables declared outside itself (like you are using).

You could use script-local or global variables instead and I suspect it would be fine.

  • Author

Hmmmm,

Thank you very much for the explanation -- I justed tested it out and changing currentField to a local (or global) variable in both the CF and the actual Calc field worked!!!

Cheers

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.