J'utilise MS SQL Server 2014 et Coldfusion 10 et je rencontre un problème de publication sur ma table. Mon total associé pour certains utilisateurs sur ma table est ignoré lorsque le fichier PDF est créé. Est-ce que quelqu'un sait ce que je fais de mal qui ferait en sorte que le champ Associate Total soit simplement ignoré pour quelques utilisateurs?Table CF ignorer les lignes lors de la création de la table
<cfset date1 = CREATEODBCDATETIME(form.StartDate & '00:00:00')>
<cfset date2 = CREATEODBCDATETIME(form.EndDate & '23:59:59')>
<!--- WHITELIST OF VALID LOCATIONS --->
<cfset validLocs = "OPERATIONS, CCC, QA, DS, PS, LWR, NR, SDL, FSC">
<cfset locList = "">
<cfif structKeyExists(FORM,"location") AND len(FORM.location) GT 0>
<cfloop list="#FORM.location#" index="vLoc">
<cfif listContainsNoCase(validLocs, vLoc) GT 0>
<cfset locList = listAppend(locList,vloc)>
</cfif>
</cfloop>
<cfelse>
</cfif>
<cfquery datasource="#application.dsn#" name="GetEmployeeInfo">
SELECT *
FROM (
SELECT t1.associate
, a.assoc_name
, t1.trans_location
, t1.checklistsByAssocLoc
, t1.totalChecklistsByAssoc
, CASE WHEN (coalesce(t1.totalChecklistsByAssoc,0) > 0) THEN (CAST(t1.checklistsByAssocLoc AS decimal(8,2))/t1.totalChecklistsByAssoc) * 100 ELSE 0 END AS totalChecklistsByAssocLocPct /* This gives you a percent of associate location checklists over count of checklists by Associate */ , t1.totalChecklistsByLoc
, CASE WHEN (coalesce(t1.totalChecklistsByLoc,0) > 0) THEN (CAST(t1.checklistsByAssocLoc AS decimal(8,2))/t1.totalChecklistsByLoc) * 100 ELSE 0 END AS totalChecklistsByLocPct /* This gives you a percent of associate location checklists over count of checklists by Location */
, ROW_NUMBER() OVER (PARTITION BY associate ORDER BY associate, trans_location) AS rnA
, ROW_NUMBER() OVER (PARTITION BY associate, trans_location ORDER BY trans_location) AS rnL
, t1.rnTotAssoc
FROM (
SELECT c.associate
, c.trans_location
, COUNT(*) OVER (PARTITION BY c.associate, c.trans_location) AS checklistsByAssocLoc /* Gives you a count of checklists by Associate and Location >> I think this is 1.1 locCntr */
, COUNT(*) OVER (PARTITION BY c.associate) AS totalChecklistsByAssoc /* Gives you a count of checklists by Associate */
, COUNT(*) OVER (PARTITION BY c.trans_location) AS totalChecklistsByLoc /* Gives you a count of checklists by Location */
, ROW_NUMBER() OVER (PARTITION BY c.associate ORDER BY c.trans_location DESC) AS rnTotAssoc
FROM cl_checklists c
WHERE c.[DATE] >= <cfqueryparam value="#date1#" cfsqltype="cf_sql_timestamp" />
AND c.[DATE] <= <cfqueryparam value="#date2#" cfsqltype="cf_sql_timestamp" />
AND c.trans_location IN (<cfqueryparam value="#locList#" cfsqltype="cf_sql_varchar" list="true" /> )
) t1
INNER JOIN tco_associates a ON t1.associate = a.assoc_id
) s2
WHERE s2.rnA = 1 OR s2.rnL = 1
ORDER BY s2.assoc_name, s2.trans_location
</cfquery>
<cfif GetEmployeeInfo.recordcount is 0>
<td width="85%" valign="top" class="mainmodule"><p class="pageheader">CHECKLIST STATS REPORT</p><br />
No matching records found
</td>
</tr>
</table>
</body>
</html>
<cfelse>
<cfif FORM.Format IS "print">
<cfdocument format="pdf" scale="75" backgroundvisible="yes" overwrite="no" fontembed="yes">
<td width="85%" valign="top" class="mainmodule"><p class="pageheader">CHECKLIST STATS REPORT</p><br />
<style type="text/css">
table{
text-align:center;
}
</style>
<table>
<thead>
<th><strong>Associate Name</strong></th>
<th><strong>Location</strong></th>
<th><strong>Checklists Generated by Associate</strong></th>
<th><strong>Checklists Generated by Selected Location(s)</strong></th>
<th><strong>Associate Percentage of Location Total</strong></th>
</thead>
<tbody>
<cfoutput query="GetEmployeeInfo">
<tr>
<td><cfif rnA EQ 1><strong>#assoc_name#</strong></cfif></td>
<td><cfif rnL EQ 1>#trans_location#</cfif></td>
<td>#checklistsByAssocLoc#</td>
<td>#totalChecklistsByLoc#</td>
<td>#DecimalFormat(totalChecklistsByLocPct)# %</td>
</tr>
<cfif rnTotAssoc EQ 1>
<tr>
<td>Associate Total</td>
<td></td>
<td>#totalChecklistsByAssoc#</td>
<td>#totalChecklistsByLoc#</td>
<td>#DecimalFormat(totalChecklistsByLocPct)# %</td>
</tr>
</cfif>
</cfoutput>
</tbody>
</table>
</cfdocument>
</cfif>
</cfif>
Les résultats devraient ressembler à:
Brierton, David SDL 1 32195 0.00 %
Associate Total 1 32195 0.00 %
Certains sont MONTRANT simplement:
Brierton, David SDL 1 32195 0.00 %
À quoi 'rnTotAssoc' est-il égal dans ce cas? –
il est égal à 1 –
bien que ceux qui travaillent sont égaux à 1 les autres ne montrent pas donc je ne sais pas ce qu'il ya –