Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
shastamatt #1
Computing age from a date
Hello Everyone,
I understand how to compute the age from the date of birth on a single record.
<cfset pat_age=#datediff('yyyy',DateOfBirth,TreatmentDate )#>
I have a table which holds of which has a date of precedure and other fields.
I have another table which will give the Date Of Birth. How can I determine
the age of a person at a date and then insert into the List I need to output.
<cfquery datasource="#ds#" name="getprocedurelist">
SELECT *
FROM tbltreatmentlist
WHERE TreatmentListclientID=#session.clientID#
</cfquery>
<cfquery datasource="#DS#" name="getPatientDOB">
SELECT PATBirthDate
From tblPatientInformation
</cfquery>
<cfquery datasource="#DS#" name="getClientDOB">
SELECT BirthDate
From tblClientInformation
</cfquery>
<cfif getpatientDOB.recordCount IS 0>
<cfset DateOfBirth=#GetPatientDOB.patBirthdate#>
<cfelse>
<cfset DateOfBirth=#GetclientDOB.Birthdate#>
</cfif>
and the output;
<tr>
<th>age</th>
<tH>date</tH>
<th>doctor</th>
<th>Procedure type/description</th>
<th>Marked?</th>
</tr>
<tr>
<td><!---get the age at treatment---></td>
<td><cfif session.usertype IS 1><input type="text" name="ProcedureDate"
<cfif action IS "change">
value="#dateformat(ProcedureDate,"mm/dd/yyyy")#"</cfif>><cfelse>#dateformat(Proc
edureDate,"mm/dd/yyyy")#|</cfif></td>
<td><input type="text" name="Doctor" <cfif action IS
"change">value="#doctor#"</cfif>></td>
<td><input type="text" name="Description" <cfif action IS "change">
value="#Description#"</cfif>></td>
<td><input type="text" name="Marked" <cfif action IS
"change">value="#Marked#"</cfif>></td>
</tr>
</cfoutput>
<cfelse>
<tr>
<td colspan="5">There are no procedures entered yet.</td>
</tr>
</cfif>
As you can clearly see....I am lost..
Thanks for your help
shastamatt Guest
-
Computing columns in dtagrids
Hi all :-) I'm having a BIG problem with getting a grand total in a data grid. I'm sorry, this is sort-of a double-post, but I REALLY need some... -
University of Plymouth Computing Industry Perception Study
First of all, can I reassure you that this posting is NOT spam and not market research. Please feel free to email me at the address below to... -
Univeristy of Plymouth Computing Industry Perception Study
First of all, can I reassure you that this posting is NOT spam and not market research. Please feel free to email me at the address below to... -
[PHP] computing 2 value and adding it..
if($pcs_1000){ $total = $amount * 2; } -----Original Message----- From: Louie Miranda Sent: Sunday, July 20, 2003 7:53 PM To:... -
[SUN] Throughput Computing
Paul Gress <pgress@pb.net> writes: Have you tried the port of Pro/ENGINEER Wildfire to GNU/Linux? HP sells GNU/Linux workstations that are... -
BSterner #2
Re: Computing age from a date
I'm assuming you're looping throught the 'getprocedurelist' query to output the
information. So, you just calculate the age at each iteration of your query
output loop.
================================================== =========
<cfquery datasource="#ds#" name="getprocedurelist">
SELECT *
FROM tbltreatmentlist
WHERE TreatmentListclientID=#session.clientID#
</cfquery>
<cfquery datasource="#DS#" name="getPatientDOB">
SELECT PATBirthDate
From tblPatientInformation
</cfquery>
<cfquery datasource="#DS#" name="getClientDOB">
SELECT BirthDate
From tblClientInformation
</cfquery>
<cfif getpatientDOB.recordCount IS 0>
<cfset DateOfBirth=#GetPatientDOB.patBirthdate#>
<cfelse>
<cfset DateOfBirth=#GetclientDOB.Birthdate#>
</cfif>
<!--- Output ages at time of treatment --->
<cfoutput query="getprocedurelist">
<cfset pat_age = DateDiff('yyyy', variables.DateOfBirth,
getProcgetprocedurelistedureList.TreatmentDate)>
My age at the time of treatment was: #pat_age#<br />
</cfoutput>
================================================== =========
Either that or you could just use the 'datediff' function in your
'getprocedurelist' SQL statement so it's returning it as a query column.
Personally, I'd opt for the latter.
BSterner Guest



Reply With Quote

