public Table getTable2() {
try {
//select data from OrderTempList database show on grid table
//recordstoretemp = RecordStore.openRecordStore("OrderTempListDB", true);
openRecStore();
byte[] byteInputData = new byte[200];
ByteArrayInputStream inputStream = new ByteArrayInputStream(
byteInputData);
DataInputStream inputDataStream = new DataInputStream(inputStream);
numrec = recordstoretemp.getNumRecords();
System.out.println("Total records :"+ numrec);
for (int j = 1; j <= numrec; j++) {
recordstoretemp.getRecord(j, byteInputData, 0);
Salesname = inputDataStream.readUTF();
Partyname = inputDataStream.readUTF();
Itemlist = inputDataStream.readUTF();
Listofweight = inputDataStream.readUTF();
Quantity = inputDataStream.readUTF();
Datetime = inputDataStream.readUTF();
System.out.println(Partyname + ":::" + Itemlist + ":::"
+ Quantity + ":::" + Listofweight);
try {
if (table2 == null) {
int a = numrec;
String SivaStore = Partyname.toString();
String ToorDhall = Itemlist.toString();
String kg = Listofweight.toString();
String aa = Quantity.toString();
TableCell cells[][] = new TableCell[a][4];
for (int i = 0; i < a; i++)
{
System.out.println("table values");
cells[i][0] = new TableCell(
TableCell.CellType.STRING1, SivaStore);
cells[i][1] = new TableCell(
TableCell.CellType.STRING2, ToorDhall);
cells[i][2] = new TableCell(
TableCell.CellType.STRING3, kg);
cells[i][3] = new TableCell(
TableCell.CellType.NUMBER, String
.valueOf(aa));
}
String header[] = new String[] { "PartyName",
"ItemName", "WightItem", "Quantity" };
setData(new int[] { 120, 80, 70, 70 }, header, cells);
}
} catch (ArrayIndexOutOfBoundsException e) {
// TODO: handle exception
System.out.println("Error" + e.getMessage());
//e.printStackTrace();
}
inputStream.reset();
}
closeRecStore();
inputStream.close();
}
catch (Exception error) {
error.printStackTrace();
}
return table2;
}