Jump 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.
Juggernaut

Calc Help: Date to Color

Featured Replies

Hi, it's been a while! Miss me? Nahhhhh, I didn't think so.

Here's the problem: I have a field (CurrentDate, which is formulated as[Get(CurrentDate)]) that reflects today's date (08.24.2006). There's another field, DueDate (a Date field), that has a due date of 08.30.2006. With a calculation of DueDate-CurrentDate, a black "6" will appear in the DaysToGo field. Conversely, if I put 08.10.2006 in the DueDate Field, the result is "-14" since I passed the due date by 14 days. Cool.

Now, what I want to happen is that if there are "x" days left before the due date, the DaysToGo field will reflect the number of those days in black; if time slips away so the DueDate has passed, I want the DaysToGo field's number to turn red.

To throw another wrench in the works, I'd also like to use the Abs command so there's no minus sign before the number in the DaysToGo field if the DueDate has passed.

As always, thanks in advance for solving this major brain hernia for me!

Ciao,

Rich

See if this will work for you. I had to add another calculated field called display_Daystogo (but maybe you can test this method and eliminate the extra field). I used TextColor and a if statement

display_Daystogo=

If ((days to go>0);TextColor(Abs(days to go);RGB(0;0;0));TextColor(Abs(days to go);RGB (255;0;0)))

Hope that helps or sparks some ideas

Edited by Guest

  • Author

Worked like a charm! Thank you!!

  • Author

Okay, another brain hernia: I used the above calc for two fields like this:

SC_Months_Left =

If ((SC_Months_Left_calc>0);TextColor(Abs(SC_Months_Left_calc);RGB(0;0;0));TextColor(Abs(SC_Months_Left_calc);RGB (255;0;0)))

...and...

SC_Months_Left_calc =

Month (SC_Date_Due) - Month (Get(CurrentDate))

Now, the month count is correct, but when I enter an "overdue" date, the month's color doesn't turn red unless I left-click my mouse in the SC_Months_Left field; otherwise, it's black. So, how do I get it to turn red without having to click in its field?

Are both fields (SC_months_left_calc & SC_Months_Left) unstored?

  • Author

Yes, they're both unstored...and have to be else if I were to change the storage option of either field, FM balks at it (see the attached error message).

UPDATE: I found the problem--they're both number fields. However, the format of one of the fields was set to Decimal instead of General, so that's what hung things up; when it was changed to General, the calc worked.

Thanks for trying to help!

FMP_error.jpg

Edited by Guest
Solution found. :D

Create an account or sign in to comment

Important Information

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

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.