Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted


Let ( [

~isSameFIeld = "firstName" ;

[color=#ff0000][b][i]~isSameField = $$SORT.FIELD = ~field ; $$SORT.FIELD = ~field //THIS HAS ME BAFFLED?[/i][/b][/color]

];



~isSameField )



I JUST dont understand the mult-equals for all those variables?

anyone ?

-i

Posted

The equals sign "=" servers two purposes in a calculation engine. Firstly, it's a comparison test. The expression 2+2 = 4 returns 1 ( True ). 2+2 = 5 returns 0 ( False ). Secondly, within a Let() statement, it's an assignment operator. It permits you to define a variable. Let([ x = 3 ; result = x + 2 ]; result ) returns 5.

There's an error in that calculation, I'm guessing the first ~isSameField should actually be ~field. And on top of that, it's unclear what the calc is supposed to do, set the sort field variable and return if it's been changed? One thing that happening is there's a test to see if the ~field is the same as the $$SORT.FIELD = $$SORT.FIELD = ~field . The result of that test is being stored in the variable ~isSameField.

~isSameField = $$SORT.FIELD = ~field

could be made clearer by adding parens:

~isSameField = ( $$SORT.FIELD = ~field )

Let ( [

//define the local variable ~field

~field = "firstName" ;

//check to see if the global variable SORT.FIELD is the same as the local ~field

~isSameField = $$SORT.FIELD = ~field ;

//redefine the global variable SORT.FIELD

$$SORT.FIELD = ~field

];

//return the result of the test...has $$SORT.FIELD been redefined or not?

~isSameField

)

Posted




Let ( [ 

~field = "firstName" ; 

~isSameField = $$SORT.FIELD = ~field ; 

$$SORT.FIELD = ~field ]; 



~isSameField )

let ~field = "firstName" => set ~field to be equal to firstName [database field name]

let ~isSameField = $$SORT.FIELD = ~field; ( set ~isSameField = global $$SORT.FIELD then it is = ~field

set $$SORT.FIELD to be same as ~field ;

return the !~isSameField variable

i hope that is what it does. the second line is a shortcut for if, or case ; no?

Posted

let ~field = "firstName" => set ~field to be equal to firstName [database field name]

Not really. "firstName" (in quotes) is a literal text string, not a reference to a field.

Posted

Not really. "firstName" (in quotes) is a literal text string, not a reference to a field.

yes that is true - thanks again.

This topic is 4749 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
×
×
  • Create New...

Important Information

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