Newbies kjartan Posted February 28, 2002 Newbies Posted February 28, 2002 I am trying to make a list, where I color code the different lines based on a deadline date. I am using this If-Statement: [FMP-rangesize] jobber ble funnet:</font><br> <hr> <br> [FMP-CurrentSort][/FMP-CurrentSort] [FMP-record] [FMP-If: Field:deadline.lt.CurrentDate]<font face="Arial, Helvetica, sans-serif" size="1" color="#006600"> [FMP-Else] <font face="Arial, Helvetica, sans-serif" size="1" color="#FF0000">[/FMP-If] <a href="[FMP-linkrecid: layout=bestill jobb, format=flow/Detail.html]">[FMP-field: Oppgave]</a> bestilt av [FMP-field: Oppdragsgiver_navn] den [FMP-field: Oppgave_innmeldt] med deadline [FMP-field: deadline]</font> <br> <hr> <br> [/FMP-record] This does not work, the lines are green no mather what The whole point was to get the expired lines red. I also tried putting the if statement inside the <font> tag. Anybody that knows what I am doing wrong?
Keith M. Davie Posted February 28, 2002 Posted February 28, 2002 These forums are filled with information. Most questions have been answered already. Research is good for the soul. In the cdml forums do a little research. Look for a thread like "Changing text color based on content... "
Garry Claridge Posted February 28, 2002 Posted February 28, 2002 Kjartan, I think the problem exists because the CurrentDate is returning a text string. Hence, the .lt. is really not effective as you would expect for comparing dates. I would use a calculated field to set a condition; e.g. code: deadline_flag: If(deadline < Status(CurrentDate),"expired","ok") Hence, the cdml becomes: [FMP-Record] [FMP-If: Field:deadline_flag.eq.expired]<font face="Arial, Helvetica, sans-serif" size="1" color="#006600"> [FMP-Else] <font face="Arial, Helvetica, sans-serif" size="1" color="#FF0000">[/FMP-If] <a href="[FMP-linkrecid: layout=bestill jobb, format=flow/Detail.html]">[FMP-field: Oppgave]</a> bestilt av [FMP-field: Oppdragsgiver_navn] den [FMP-field: Oppgave_innmeldt] med deadline [FMP-field: deadline]</font> <br> <hr> <br> [/FMP-record] Hope this helps. Garry [ February 28, 2002, 02:13 PM: Message edited by: Garry Claridge ]
Keith M. Davie Posted March 1, 2002 Posted March 1, 2002 Garry writes, "Hence, the .lt. is really not effective as you would expect for comparing dates." If you will examine the two recent threads with "currentdate" in the subject line (one started by Turansky, one by me) you will notice that I advise against using the cdml tags -op and -lop and their related parameters in action links and form actions. In fact I posted code which allows one to do a search (db find) using the symbols of the db. I also strongly recommend reading the two articles on an exact search which I believe I cite there. I know I've cited those articles more than once a month over the past year. It took me six weeks to serendipitously find those references. They are very valuable to understanding. Understanding those two articles will help you understand the other symbols. Using these symbols one can effectively do a find of less than or greater than a currentdate, provided the dates are formatted correctly, as I so adequately demonstrated. The only additional field you will need [being in Oslo] is one which states the date formatting to the American date formatting which is the formatting FMPro uses in the "currentdate" schemata. That is the field upon which to operate. The one which agrees with the program's quirks. In order to use the .lt., .gt., etc. parameters in If conditionals on format files, at least two requirements must be met. 1. The proper action first has been applied to the db. 2. You are using the If conditional parameters correctly. The latter can be answered by the CDML Reference database. There are no easy answers. Research is good for the soul. [ February 28, 2002, 04:13 PM: Message edited by: Keith M. Davie ]
Newbies kjartan Posted March 1, 2002 Author Newbies Posted March 1, 2002 Thank you Garry Your solution did the trick. I have to say that CDML is fun and frustrating at the same time. Kjartan
Recommended Posts
This topic is 8379 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