EllenG Posted June 25, 2009 Posted June 25, 2009 I hope someone can help me with this. I created a colored bar graph using a repeated field (with 400 repetitions to represent 400 days.) I have a condition setup so that the color will be green for the 1st 300 days, then yellow for the next 40 days and then red. I use the values 0, 1 and 2 such that a value of 0 will condition green, 1 for yellow and 2 for red. The text color is set the same as the background so the values are not displayed, just the color. I have a script that will set the fields based on another field Days (which is a calc field, using the current date and a user-entered date.) The script looks like this: Set Variable $repetition = 1 Loop Set Field BarGraph($repetition) = Case ($repetition < 300; 0; $repetition < 340; 1, $repetition >= 340; 2) Exit Loop If $repetition = Days Although it works great, I want to be able to set it up as a calculation rather then a script, but can't figure out how to do it. I also want to use this same idea for another field. Hope someone can tell me how to do it. Thanks.
Ocean West Posted June 25, 2009 Posted June 25, 2009 If you want a hard coded result Let ( [ rep = Get ( CalculationRepetitionNumber ) ; cond = Case ( rep OR you can do it on a field that is just for display has 400 reps and just do all the logic on the conditional formatting
Ocean West Posted June 25, 2009 Posted June 25, 2009 If your trying to get some bar to represent a percentage of 100, put this in the conditional formatting of a repeating field of 100 reps you can set the global variables to the current and total amount so that you can calculate the percentage. Let ( [ var1 = $$current ; var2 = ValueCount ( $$total ); rep = Get ( CalculationRepetitionNumber ) ; p = ( var1 * 100 ) / var2 ] ; p ≥ rep )
EllenG Posted June 25, 2009 Author Posted June 25, 2009 OK, I'm still missing something here. Please bear with me, I am new to FMP10 and still muddling my way through all the new functions! I see how to use the Get function in the Conditional; but how do I write a calculation for the repeated field in order to get the reps or (CalculationRepetitionNumber) to equal the Days field (to control how much of the graph is filled in?) Thanks.
EllenG Posted June 25, 2009 Author Posted June 25, 2009 Got it to work using a combination of your suggestions. Thanks!!
Recommended Posts
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