Print Page | Close Window

One grid with 52 weeks

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=2328
Printed Date: 19 May 2024 at 6:33am


Topic: One grid with 52 weeks
Posted By: edsilva
Subject: One grid with 52 weeks
Date Posted: 14 Feb 2008 at 11:32am
I have a maintenance plan with those informations:
1. Equipment         A         A         C          D      D
2.Week                  1         6         4          4      7
3. Activitye             P1       P9       P6        P3     P6
 
I need to prepare a report that shows all 52 weeks but I have more then one activity by equipment.
 
My report must be:
 
Equipment WK1 WK2 WK3 WK4 WK5 WK6 WK7 WK8........ WK52
    A              P1                                      P9
    C                                       P6
    D                                       P3                   P6
 
How can I do this ?
 
Thanks for help


-------------
Ed



Replies:
Posted By: rahulwalawalkar
Date Posted: 15 Feb 2008 at 3:21am
Hi
 
Create view using the  Query at backend  and then use that view in the report.
 
"WK_ACT"."EQ",    (Equipment)
"WK_ACT"."WK"     (Week)
"WK_ACT"."ACT      (Activity)
 
 
SELECT
"WK_ACT"."EQ",    (Equipment)
MAX(case "WK_ACT"."WK" when 1 then "WK_ACT"."ACT"  end) 'WK1',
MAX(case "WK_ACT"."WK" WHEN 2 then "WK_ACT"."ACT"  end) 'WK2',
MAX(case "WK_ACT"."WK" WHEN 3 then "WK_ACT"."ACT"  end) 'WK3',
MAX(case "WK_ACT"."WK" WHEN 4 then "WK_ACT"."ACT"  end) 'WK4',
MAX(case "WK_ACT"."WK" WHEN 5 then "WK_ACT"."ACT"  end) 'WK5',
MAX(case "WK_ACT"."WK" WHEN 6 then "WK_ACT"."ACT"  end) 'WK6',
MAX(case "WK_ACT"."WK" WHEN 7 then "WK_ACT"."ACT"  end) 'WK7'
FROM "Test"."dbo"."WK_ACT" "WK_ACT"
GROUP BY "WK_ACT"."EQ"
 
I have done it for 7 weeks... you need to code remaining weeks.......

Output
 
EQ WK1 WK2 WK3 WK4 WK5 WK6 WK7
A P1         P9  
C       P6      
D       P3     P6
 
 
Cheers
Rahul


Posted By: edsilva
Date Posted: 15 Feb 2008 at 3:57am
That is a good idea, I will test it.
 
Thaks a lot.
 
Edsilva


-------------
Ed



Print Page | Close Window