Working on our fire report system...
Tracking who is on trucks... So Truck A, Truck B, Truck C
I can get the counts of total staff - but not for each truck... I'm a bit out of ideas... using ColdFusion 8
This (vehicle ID Number) nvid stuff I know doesn't work - just counts total staff but not individual trucks. Each individual truck has a unique ID and staff variable attached to it... The CFInserts work fine for total numbers but not each truck number.
Ideas on how to track numbers of staff on each truck? Thx...
<cfset nvid = 0>
<cfloop from="1" to="#st.recordcount#" index="i">
<cfif IsDefined("form.checkbox1_#i#")>
<cfoutput>
<cfset newvid = "vid_"&#variables.i#>
<cfset newloginid = "checkbox1_"&#variables.i#>
<cfset vid = "#Evaluate(variables.newvid)#">
<cfset nvid = nvid + 1>
<cfset loginid = "#Evaluate(variables.newloginid)#">
<br>
NewVid - #newvid# and VID - #vid#
<br>
cfquery name="insert" datasource="fire_report">
INSERT INTO stafflist (id, unitid, loginid)
VALUES (#id#, #vid#, #loginid#);
/cfquery>
<br>
<br>
</cfoutput>
</cfif>
</cfloop>
Decided to check data after the insert.. It works and perhaps this was the easiest way unless anyone has anything else simpler...
Basically - if the numbers don't add up on a group check - I cflocation it to delete the previous data inserted and force them to do it again...
Check Data After Insert???
<cfquery name="tcheck" datasource="fire_report">
select * from stafflist
order by unitid
</cfquery>
<br>
<cfoutput query="tcheck" group=unitid>
<cfset groupCount = 0>
<cfoutput>
#unitid#
<cfset groupCount = groupCount + 1>
</cfoutput>
<br><br>Check vs Original
<br>
<cfquery name="ucheck" datasource="fire_report">
select * from unit
WHERE ID=#id# and unitid = #unitid#
</cfquery>
Original: <cfoutput>#ucheck.unitid# - #ucheck.numff# </cfoutput>
GroupCount = #groupCount#
<br><br><cfif ucheck.numff NEQ groupCount>
Bad<br>
<cflocation url="staff.cfm?id=#id#&src=del">
<cfelse>All Good<br></cfif>
</cfoutput>