Skip to main content
Inspiring
May 10, 2006
Answered

Querey Issues

I have a Querey that select patients based upon there appointment being two days ahead of today..which means it selects all patients appointment two days ahead..But when it is friday it will select patients for sunday but there are none, so it needs to select the patients for Monday...I was wondering how can i do this do i have to add another querey or should i just change the one i have to something eles........kinda lost

<cfset ydate = DateFormat(DateAdd("d", +2, Now()), "MM/DD/YYYY")>
<cfset tdate = DayOfWeek(Now())>

<cfquery datasource="bashful_emoi" name="res">
Select * From Patients where doc_code ='RA' and date_seen LIKE '%#ydate#' Order By last_name ASC
</cfquery>






<table border=0 cellspacing=0 cellpadding="4px" align="center">

<tr>
<td height="15px" background="topline.gif" class="lefttopbottom"><b><center>Name</center></b></td>
<td height="15px" background="topline.gif" class="topbottom"><b><center>Appointment Date</center></b></td>
<td height="15px" background="topline.gif" class="toprightbottom"><b><center>Provider</center></b></td>
<td height="15px" background="topline.gif" class="toprightbottom"><b><center>Location</center></b></td>
</tr>

<cfoutput query="res">
<tr>
<td class="leftrightbottom">#res.last_name# , #res.first_name#</td>
<td align="center" class="rightbottom">#res.date_seen#</td>
<td aligm="center" class="rightbottom"><select><option></option><option>Ramig DPM , David L</option><option>Nicely DPM, Lisa</option><option>Greenberg DPM , Marc S</option></select></td>
<td align="center" class="rightbottom"><input type="text" size="20"></td>
</cfoutput>
</table>







</body>
</html>
This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer
May 10, 2006
You are missing a comma after the 2
<cfset ydate = DateFormat(DateAdd("d", + 2 Now()), "MM/DD/YYYY")>
Same problem on two others, also.

4 replies

May 10, 2006
You need to check to see if Now( ) + 2 is a Saturday or Sunday and set ydate accordingly. See below.
Translate
Inspiring
May 10, 2006
I need to check and see if it is Sat Sun or Friday.....This should work right but it says i have an invalid cfml construct i dont know whyy thought....


<cfset tdate = DayOfWeek(Now())>

<cfif tdate IS 1>
<cfset ydate = DateFormat(DateAdd("d", +2 Now()), "MM/DD/YYYY")> My error comes here
<cfelseif tdate IS 7>
<cfset ydate = DateFormat(DateAdd("d", +2 Now()), "MM/DD/YYYY")>
<cfelseif tdate IS 6>
<cfset ydate = DateFormat(DateAdd("d", +3 Now()), "MM/DD/YYYY")>
<cfelse>
<cfset ydate = DateFormat(DateAdd("d", +2, Now()), "MM/DD/YYYY")>
</cfif> Text <cfset ydate = DateFormat(DateAdd("d", +2 Now()), "MM/DD/YYYY")>
Translate
Correct answer
May 10, 2006
You are missing a comma after the 2
<cfset ydate = DateFormat(DateAdd("d", + 2 Now()), "MM/DD/YYYY")>
Same problem on two others, also.
Translate
Inspiring
May 10, 2006
I didnt mean to post this three times!!!
Translate