Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Using a calculation to create a colored line

Featured Replies

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.

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

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



)

  • Author

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.

  • Author

Got it to work using a combination of your suggestions.

Thanks!!

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.