Jondb Posted September 29, 2004 Posted September 29, 2004 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.
Wim Decorte Posted September 29, 2004 Posted September 29, 2004 Check out the "Text formatting functions" section of the help file. It describes the relevant calculations you can use. HTH Wim
Jondb Posted September 29, 2004 Author Posted September 29, 2004 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?
-Queue- Posted September 29, 2004 Posted September 29, 2004 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.
Recommended Posts
This topic is 7363 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