imoree Posted November 22, 2011 Posted November 22, 2011 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
David Jondreau Posted November 22, 2011 Posted November 22, 2011 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 )
imoree Posted November 22, 2011 Author Posted November 22, 2011 thanks, so it works like a toggle on / off? -i
David Jondreau Posted November 22, 2011 Posted November 22, 2011 What the equals sign or the calculation?
imoree Posted November 23, 2011 Author Posted November 23, 2011 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?
comment Posted November 23, 2011 Posted November 23, 2011 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.
imoree Posted November 23, 2011 Author Posted November 23, 2011 Not really. "firstName" (in quotes) is a literal text string, not a reference to a field. yes that is true - thanks again.
Recommended Posts
This topic is 5100 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 accountSign in
Already have an account? Sign in here.
Sign In Now