Johnny5 Posted October 31, 2005 Posted October 31, 2005 Hi this is a two part question. 1. How do repeating calculations exactly work. I dont understand them 2. If I have a global calculation field that shows the direction of a sort, asc / desc arrows, and I want to show it for a few different portal fields, do i gotta have seperate field for each one? Right now I have seperate ones for each of them. I want to see if there is a better way. like 1 big case statement or something. Right now the code looks like this for each field where f and d are global number fields [b]Arrow1[/b] Case( f = 1 and d = 1; cgArrowUp; f = 1 and d = 2; cgArrowDown; cgArrowUp ) ) [b]Arrow2[/b] Case( f = 2 and d = 1; cgArrowUp; f = 2 and d = 2; cgArrowDown; cgArrowUp ) ) [b]Arrow3[/b] Case( f = 3 and d = 1; cgArrowUp; f = 3 and d = 2; cgArrowDown; cgArrowUp; ) ) [b]etc[/b]
CyborgSam Posted October 31, 2005 Posted October 31, 2005 Repeating calcs reference another field's repetition using the calc's repetition unless the Extend function is used. Given a repeating text field named Color with Color[1] = "Red", Color[2] = "Blue" and Color[3] = Green. A repeating calculation with If ( Color = "Red" ;... will have repetition 1's If test true and repetitions 2 and 3's false. Add another field, non-repeating, named myHue with the value "Red". If the calc is changed to If ( myHue = "Red" ;..., repetition 1 will be true, and all others false. If the calc is If ( Extend ( myHue ) = "Red" ;..., all repetitions will be true. In the above calc, I assume that f and d are non-repeating fields and the calc is a repeating field. To work, it would have to have an Extend () around each f and d. Instead of manually specifying the = # for f, use Get ( CalculationRepetitionNumber ). And a tip from the above code: Case( f = 1 and d = 1; cgArrowUp; f = 1 and d = 2; cgArrowDown; cgArrowUp ) can be simplified to Case ( f = 1 and d = 2; cgArrowDown; cgArrowUp ) That's a start, I guessed at a lot, so give us more info if this doesn't address the issue.
Johnny5 Posted November 1, 2005 Author Posted November 1, 2005 Thank you CyborgSam. That helps clarify things a somewhat. Basically I have a few field containers right now that depending on the field number and the direction field, should either show the Asc or Desc arrow icon. Case ( f = 1 and d = 2; cgArrowDown; cgArrowUp ) So if I had 10 of these global cal fields (container), that need to show arrows I would need 10 seperate fields. I was trying to see if there was a better way of doing this through repeating calculations or something and consolidate these 10 into 1. But now I dont think this is possible so I will just use the multiple fields.
Ender Posted November 1, 2005 Posted November 1, 2005 If you keep your sort orders in a repeating field; then the calc to display the graphics is simple: ArrowUp (container, global) ArrowDown (container, global) SortOrder[10] (text field, repeating) SortDisplay[10] (calculation, container result, repeating) = case(SortOrder = 1; extend(ArrowUp); extend(ArrowDown)) Each repetition is evaluated in the repeating calc.
Recommended Posts
This topic is 7027 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