Bookmark Topic Watch Topic
  • New Topic

Need HELP with LOOPS  RSS feed

 
jay lai
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have retriece a set of record from Database and place into the Array
DivisionID DepartmentID Class ID departmentName ClassName
123 D-1 C-1 DN-1 CN-1
123 D-1 C-2 DN-1 CN-2
123 D-2 C-1 DN-1 CN-1
123 D-3 C-3 DN-1 CN-3
345 D-4 C-4 DN-2 CN-4
So the report display as group by
Sample:
DivisionID: 123
DepartmentID: D-1
DepartmentName: DN-1
ClassID: C-1
ClassName: CN-1
ClassId: C-2
ClassName: CN-2
DepartmentID: D-2
DepartmentName: DN-1
ClassID: C-1
ClassName: CN-1
DepartmentID: D-3
DepartmentName: DN-1
ClassID: C-3
ClassName: CN-3
Division: 345
DepartmentID: D-4
DepartmentName: DN-2
ClassID: C-4
ClassName: CN-3



[code]

class FormatMe{private Vector scHistory = null; FormatMe( MergeData [] scMergeArray) //constructor private void displayReport(){ if (scMergeArray == null || scMergeArray.length == 0) { return; } scHistory.addElement(""); scHistory.addElement("SERIES AND CLASSES (CONTRACTS) SUMMARY:"); if (scMergeArray.length > 0) { int x=0; FNSeriesClassMergeData theMergerData = new FNSeriesClassMergeData(); String divID = ""; String deptID = ""; String classID = ""; for (int m=0; m < scMergeArray.length; m++) { theMergerData = scMergeArray[m]; //place data into array if (!theMergerData.divID.equals(divID) || !theMergerData.deptID.equals(deptID)|| !theMergerData.classID.equals(classID)) { if (x == 0) { scHistory.addElement(""); scHistory.addElement("Report Sample"); } x++; if (x > 1) { scHistory.addElement(""); } // display the top portion scHistory.addElement(lineNumber(x) + "Division ID:" + theMergerData.divID); } }}{

[code]

I got stuck at how do I print Department ID if it change within the Division ID, and how to print the Class ID group if it change within division and department id.

Many thanks for your greatful help. Thank in advance for your kindness response or hints or code hints
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
jay, please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!