Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if month(date) EQ month(now()) 1

Status
Not open for further replies.

beckyh

Programmer
Apr 27, 2001
126
US
Can I do something like this?
<cfif month(GetSAP.DateEntered) EQ month(now())>
<font color="#FF0000">
<cfelse>
<font color="#000000">
<td valign="top" width="50">#GetSAP.AccountNumber#</td>
<td valign="top" width="230">#GetSAP.CompanyName#</td>
<td valign="top" width="150">#GetSAP.Address1#</td>
<td valign="top" width="50">#GetSAP.City#</td>
<td valign="top" width="40">#GetSAP.State#</td>
<td valign="top" width="50">#GetSAP.Zip#</td>
<td valign="top" width="100">#GetSAP.Phone#</td></font></font></cfif>

I am getting Just in time compilation error

Invalid parser construct found on line 72 at position 31. ColdFusion was looking at the following text:

"

Any ideas are appreciated! Thanks :)
 
yep

you need to escape your # signs inside cfoutput tags

<cfif month(GetSAP.DateEntered) EQ month(now())>
<font color="#FF0000">
<cfelse>
<font color="##000000">


Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 
oops one of thoes didn't take

<cfif month(GetSAP.DateEntered) EQ month(now())>
<font color="##FF0000">
<cfelse>
<font color="##000000">

Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 
Be careful when using the octothorpe.

<font color="#FF0000"> will cause an error if it is inside of <cfoutput>.

You must escape the octothorpe as <font color="##FF0000">. Although not recommended, these days you can get away with
<font color="FF0000">.
 
not recommended at all.

not to mention if you try to use styles it will not work at all

<span style = "color: FF0000">bla</span>
this will not work, in fact you'll get a color you didn't expect. usualy something in the grey scale but not always.

Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 
I am not getting the expected results. it is not displaying the row in red that meets the criteria. it's there, but not displayed.
 
you wouldn't.

according to your IF you only create the table cells if the black condition is true.

you should really put your font colors inside the cells and only include the text.

but this will fix your problem
but try this instead
<font color = <cfif month(GetSAP.DateEntered) EQ month(now())>
FF0000"<cfelse>"##000000"</endif>>
<td valign="top" width="50">#GetSAP.AccountNumber#</td>
<td valign="top" width="230">#GetSAP.CompanyName#</td>
<td valign="top" width="150">#GetSAP.Address1#</td>
<td valign="top" width="50">#GetSAP.City#</td>
<td valign="top" width="40">#GetSAP.State#</td>
<td valign="top" width="50">#GetSAP.Zip#</td>
<td valign="top" width="100">#GetSAP.Phone#</td></font>


Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 
forgot the ## before the FF0000.

Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 
No luck. Still yields the same results.
 
what do you have now?
when you say not displayed what do you mean? not creating cell or just no text?

Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 
I am sorry about the confusion. This is what I am after. If DateEntered's month equals today's month, I want it to display in red.

Your second question, no text, however if I move </cfif> I get no cells created.
 
ok so what is your code now?


Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 
<cfif dateformat(GetSAP.DateEntered,"mmm") is dateformat(now(),"mmm")>
<font color="##FF0000">
<cfelse>
<font color="##000000">
<td valign="top" width="50>#GetSAP.AccountNumber#</td>
<td valign="top" width="230">#GetSAP.CompanyName#</td>
<td valign="top" width="150">#GetSAP.Address1#</td>
<td valign="top" width="50">#GetSAP.City#</td>
<td valign="top" width="40">#GetSAP.State#</td>
<td valign="top" width="50">#GetSAP.Zip#</td>
<td valign="top" width="100">#GetSAP.Phone#</td> </cfif>
 
the way you have it now is the only time the cells will be displayed is if the months are not equal and display black.

try this instead i wrapped the text with fonts and not the whole row.

Code:
<td valign="top" width="50><cfif dateformat(GetSAP.DateEntered,"mmm") is dateformat(now(),"mmm")>
<font color="##FF0000"> 
<cfelse>
<font color="##000000">#GetSAP.AccountNumber#</font></td>
<td valign="top" width="230"><cfif dateformat(GetSAP.DateEntered,"mmm") is dateformat(now(),"mmm")>
<font color="##FF0000"> 
<cfelse>
<font color="##000000"></cfif>#GetSAP.CompanyName#</font></td>
<td valign="top" width="150"><cfif dateformat(GetSAP.DateEntered,"mmm") is dateformat(now(),"mmm")>
<font color="##FF0000"> 
<cfelse>
<font color="##000000"></cfif>#GetSAP.Address1#</font></td>
<td valign="top" width="50"><cfif dateformat(GetSAP.DateEntered,"mmm") is dateformat(now(),"mmm")>
<font color="##FF0000"> 
<cfelse>
<font color="##000000"></cfif>#GetSAP.City#</font></td>
<td valign="top" width="40"><cfif dateformat(GetSAP.DateEntered,"mmm") is dateformat(now(),"mmm")>
<font color="##FF0000"> 
<cfelse>
<font color="##000000"></cfif>#GetSAP.State#</font></td>
<td valign="top" width="50"><cfif dateformat(GetSAP.DateEntered,"mmm") is dateformat(now(),"mmm")>
<font color="##FF0000"> 
<cfelse>
<font color="##000000"></cfif>#GetSAP.Zip#</font></td>
<td valign="top" width="100"><cfif dateformat(GetSAP.DateEntered,"mmm") is dateformat(now(),"mmm")>
<font color="##FF0000"> 
<cfelse>
<font color="##000000"></cfif>#GetSAP.Phone#</font></td>

Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 
i used this instead....

<cfif dateformat(GetSAP.DateEntered,"mmm") is dateformat(now(),"mmm")>
<cfset vcolor="FF0000">
<cfelse>
<cfset vcolor="000000">
</cfif>
<td valign="top" width="50" style="color:###vcolor#;">#dateformat(GetSAP.DateEntered,"mmm")# #dateformat(now(),"mmm")# #GetSAP.AccountNumber#</td>
<td valign="top" width="230" style="color:###vcolor#;">#GetSAP.CompanyName#</td>
<td valign="top" width="150" style="color:###vcolor#;">#GetSAP.Address1#</td>
<td valign="top" width="50" style="color:###vcolor#;">#GetSAP.City#</td>
<td valign="top" width="40" style="color:###vcolor#;">#GetSAP.State#</td>
<td valign="top" width="50" style="color:###vcolor#;">#GetSAP.Zip#</td>
<td valign="top" width="100" style="color:###vcolor#;">#GetSAP.Phone#</td>

How do you insert your code into the gray code box like that??
 
You use TGML. Whenever you want something in code boxes, just type [ c o d e ] before and [ / c o d e ] after whatever you want in the box. Of course, I had to put spaces in my example so you could see it, so you would need to remove them to make it work.

You can click on the "Process TGML" link just above the "Submit Post" button and it will give you a list of some of the more popular commands.



Hope This Helps!

Ecobb
Beer Consumption Analyst

"My work is a game, a very serious game." - M.C. Escher
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top