Jump to content

This topic is 8379 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

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 mad.gif 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?

Posted

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... "

Posted

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 ]

Posted

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
Posted

Thank you Garry smile.gif

Your solution did the trick. I have to say that CDML is fun and frustrating at the same time.

Kjartan

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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