Jump to content

Evaluate within a recursive CF


Genx
 Share

This topic is 5793 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This topic is 5793 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

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