November 22, 201114 yr 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
November 22, 201114 yr 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 )
November 23, 201114 yr Author 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?
November 23, 201114 yr 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.
November 23, 201114 yr Author Not really. "firstName" (in quotes) is a literal text string, not a reference to a field. yes that is true - thanks again.
Create an account or sign in to comment