Prints data twice in each page

  • I need to print order data twice in each page like below. 


    If there are more than 10, then it has to go the next page and print rest like below.

    What is the trick for this???

  • My first question is WHY?   What possible benefit is there to this methodology?

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • I wish I knew. That's what the business wants.I wish I knew. That's what the business wants. I am trying to figure out a way to go back to the first record and print again once it reaches to row number 10. I'm not sure whether it is doable. 🙁

  • chulheekim - Thursday, March 8, 2018 9:56 AM

    I wish I knew. That's what the business wants.I wish I knew. That's what the business wants. I am trying to figure out a way to go back to the first record and print again once it reaches to row number 10. I'm not sure whether it is doable. 🙁

    Why not just give them 2 copies of the same report?   From an audit perspective, it would be easy for you to defeat any audit inspection, given that you are designing the report, so audit isn't a VALID reason for such a request.   It's also inefficient and a waste of paper.   They really do need a better reason to waste both the compute resources as well as the excess paper if they ever print it.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • I hear you. But I'm a programmer and get paid to make whatever they want.😎

  • Hmm... maybe you can do something with this, I'm not an expert on formatting reports in SSRS but in some systems this would work for what you're trying to do if you can create a page grouped by page id with sub groups based on sub page id.  You would end up with a data set broken out by a page id, in increments of 10 over all sets of orders duplicated with a different sub page id for each block of 10.  So the data set below would have 4 page ids, 8 sub page ids and the last page id would have 5 unique orders duplicated.

    CREATE TABLE #TEMP_ORDER(ORDER_NUM varchar(50), CUST_NUM varchar(30), ORDER_DATE datetime, AMOUNT decimal(29, 9) )
    GO

    INSERT INTO #TEMP_ORDER
    SELECT CAST(NEWID() AS varchar(50)), 'C01953', DATEADD(day, CAST(RAND() *100 AS int), '20180101' ), RAND() * 100;
    GO 35

    WITH TEMP_CTE AS(
    SELECT LOWER((ROW_NUMBER() OVER(PARTITION BY CUST_NUM ORDER BY CUST_NUM) - 1) / 10) AS PAGE_ID, ROW_NUMBER() OVER(PARTITION BY CUST_NUM ORDER BY CUST_NUM) AS ROW_NUM, * FROM #TEMP_ORDER
    ), TEMP_CTE_TWO AS( SELECT 0 AS SUB_PAGE
    UNION ALL
    SELECT COUNT(*) + 1 AS MAX_FLOOR FROM TEMP_CTE
    ), TEMP_CTE_THREE AS(
    SELECT TEMP_CTE.PAGE_ID + TEMP_CTE_TWO.SUB_PAGE AS SUB_PAGE_ID, TEMP_CTE.* FROM TEMP_CTE, TEMP_CTE_TWO
    )
    SELECT * FROM TEMP_CTE_THREE
    ORDER BY PAGE_ID, SUB_PAGE_ID

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply