0
Creating Cross Tab Report
Explorer
,
/t5/coldfusion-discussions/creating-cross-tab-report/td-p/12207516
Jul 26, 2021
Jul 26, 2021
Copy link to clipboard
Copied
Hello Community Members,
I've written a query that generates Cross Tab or Pivot. Image Below. My Query is as follows
SELECT * FROM
(
SELECT TOP(100) PERCENT production.Line_FK_ID,
Lines.LineName,production.OP_FK_ID,
Operations.OperationName,
[Shift].ShiftID,[Shift].ShiftName,
production.op_Time_From,
production.Production
FROM production
JOIN Operations
on Operations.opID=production.OP_FK_ID
JOIN Lines
on Lines.lineID=production.Line_FK_ID
JOIN [Shift]
on [Shift].ShiftID=production.Shift_FK_ID
WHERE
ShiftID in (1)
and op_date in ('2021-07-08')
Order by production.op_Time_From
) Report
PIVOT
(
Sum (Production)
FOR OP_TIME_FROM
IN (
[06:30:00],[07:30:00],[08:30:00],[09:40:00],[10:30:00],[11:30:00],[13:00:00],[13:30:00],[14:30:00]
)
) As Pivot_Report
I want to make PDF report in which Production Line Wise for 6 operations for each hour. I am unable to Pivot the Hours Horizontly. The CFDUMP is as follows
TOPICS
Advanced techniques
,
Reporting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/coldfusion-discussions/creating-cross-tab-report/m-p/12207551#M189368
Jul 26, 2021
Jul 26, 2021
Copy link to clipboard
Copied
Please clarify. Do you mean you want to create output that DOES look like the dump (hours horizontally), or which inverts things (hours vertically)? Or do you mean something else by pivot? (I do see the sql doing a pivot, of course.)
Also, how are you wanting the output to appear? As html? As a PDF? As a spreadsheet? Cf supports them all, and with multiple options for each. What have you tried?
Finally, what version of CF are you using?
/Charlie (troubleshooter, carehart.org)
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/coldfusion-discussions/creating-cross-tab-report/m-p/12219361#M189434
Jul 31, 2021
Jul 31, 2021
Copy link to clipboard
Copied
Could you explain what you mean by
- Production Line Wise for 6 operations for each hour.
- Pivot the Hours Horizontly
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

