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.

script for changing text colours

Featured Replies

I have a date field (invoices::payment due) included in a portal on another layout called 'update'. I'm trying to devise a script that will apply a text style (such as a different RGB value) to all dates in 'invoices::payment due' that are less than the current date, in other words invoices that are overdue.

I have a 'current date' field in my 'update' layout, which is updated every time the file is opened, if it's needed, but I can't figure out how to phrase the changing of the text colour. If style changes can only be applied to text fields then I can apply it to the invoice title instead (invoices::job title)

Any pointers would be appreciated.

Check out the "Text formatting functions" section of the help file. It describes the relevant calculations you can use.

HTH

Wim

  • Author

Thanks Wim.

I've put a script together, but it has one small bug which I can't figure out. I've attached a screenshot here of the portal and the script itself, so you can see how it's working.

All the fields you can see in the portal are from the table 'jobsheet 3', except for the unlabelled field on the right. The field under the label 'deadline' is the field named 'finished art' in the script. The field 'update::date' in the script is a field in the current layout which always contains today's date (currently 29/09/2004 - european date format dd mm yyyy)

The sub-scripts in my main script insert the appropriate coloured text in the unlabelled field on the right. The problem I'm having is that the script returns an incorrect result ('pending' - should be 'late') in the first line of the portal. All the other results are correct. Also, if I remove the 'Pause/resume' step after 'end if', the script returns 'pending' in all the portal rows.

Any ideas?

portal.jpg

I think it would be cleaner and more accurate to Go to Related Records [show; relationship] and loop on the found set instead of looping through the portal. Also, use Get(CurrentDate) instead of Update::Date and see if your results are correct.

Alternatively, don't use a script at all. Make your Pending/Today/Tomorrow/etc. field an unstored text calculation in the related table that uses the tests in a Case statement and returns the appropriate TextColor result.

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.