I have a table called Materials (SQL Server 2012). In that table there is a field called PartNo and one called SubPartNo. If a SubPartNo has its own SubPartNo then it will be listed further down the table. For example, PartNo 555-123 has a SubPartNo of 111-222. Part 111-222 also has its own sub parts so 111-222 is listed in the PartNo column. This will continue until all the sub parts have been listed.
PartNo
|
SubPartNo
|
Description
|
ItemNo
|
555-123
|
111-222
|
Motor Assembly
|
1
|
555-123
|
121-333
|
Bearing Shaft
|
2
|
555-123
|
131-444
|
Coupler
|
3
|
555-123
|
141-555
|
Bearing Wheel
|
4
|
111-222
|
232-999
|
Motor
|
5
|
111-222
|
232-888
|
Motor Mount
|
6
|
232-999
|
751-012
|
Motor Shaft
|
7
|
232-999
|
761-099
|
Motor Housing
|
8
|
I need the report to look like this...
555-123
|
|
|
|
|
111-222
|
Motor Assembly
|
|
|
|
232-999
|
Motor Shaft
|
|
|
232-888
|
Motor Mount
|
|
121-333
|
Bearing Shaft
|
|
|
131-444
|
Coupler
|
|
|
…
|
|
|
|
…
|
|
|
Basically, while compiling the report I need Crystal Reports to...
- "Print" the current record.
- Check if the SubPartNo in the current record is listed somewhere else in the PartNo field.
- If so, go to that record and print it
- Return to Step 2.
- If not, move to next PartNo.
- Return to Step 1.
Thanks to Dblank I can figure out how to indent the records but I can't figure out how to get Crystal Reports to follow the logic while its compiling the report.
Any help would be greatly appreciated.
Edited by highrise955 - 13 Feb 2017 at 4:07am