cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Jlink and Tables

ssuttle
7-Bedrock

Jlink and Tables

All,



I am working on a Jlink tool to replace formats. I have most of it figured out but when I read tables and run into an empty cell the program ends with out finishing. It does not die it just acts like it is done. I have not been able to figure out how to find out if the cell is empy or not. It seems like it cannot get past the call to create a stringseq of the table cell created. Any help would be appreciated. Thanks.

3 REPLIES 3

Hi Steve,



I use this code to find out whats in there.


stringseq full = tbl.GetText(pfcTable.TableCell_Create(Integer.parseInt(cellrow), Integer.parseInt(cellcol)), ParamMode.DWGTABLE_FULL);
stringseq norm = tbl.GetText(pfcTable.TableCell_Create(Integer.parseInt(cellrow), Integer.parseInt(cellcol)), ParamMode.DWGTABLE_NORMAL);
StringBuilder fulls = new StringBuilder(); //NOI18N
StringBuilder norms = new StringBuilder(); //NOI18N
par.writeLog(number + " " + full.getarraysize()); //NOI18N
if (full != null) for (int k = 0; k < full.getarraysize(); k++) {
fulls.append(full.get(k));
}
par.writeLog(number + " " + norm.getarraysize()); //NOI18N
if (norm != null) for (int k = 0; k < norm.getarraysize(); k++) {
norms.append(norm.get(k));
}



After that I get the full and norm stringbuilder and can use them. I never had problems with empty cells till today. I've used it with WF 3.0 and Creo 1.0


Best regards,


Eike



PS: Which Wildfire version do you use? So I can test it here too.


Steve -

Are you checking the returned stringseq value to be sure it isn't null?
Here's where Eike is doing that:

stringseq full = tbl.GetText(pfcTable.TableCell_Create
(Integer.parseInt(cellrow),
Integer.parseInt(cellcol)),
ParamMode.DWGTABLE_FULL);

[ ... ]

if (full != null) for (int k = 0; k < full.getarraysize(); k++) {
fulls.append(full.get(k));
}

I believe that an empty cell will return a stringseq value of null. If
you try to run any stringseq method on a null value, your application will
throw a Java NullPointerException. A try/catch block for jxthrowable does
not catch NullPointerException. All you really need to do is write an if
statement that ignores null stringseq values.

|+| M a r k |+|

Mark Stallard
Rapid Response Development
information Solutions
Integrated Defense Systems
Raytheon Company




(business)
+1.339.645.6423
(cell)
+1.617.331.5443
(tie line)
224.6423

-



235 Presidential Way
Woburn, MA 01801-1060
www.raytheon.com


Raytheon Sustainability

This message contains information that may be confidential and privileged.
Unless you are the addressee (or authorized to receive mail for the
addressee), you should not use, copy or disclose to anyone this message or
any information contained in this message. If you have received this message
in error, please so advise the sender by reply e-mail and delete this
message. Thank you for your cooperation.









ssuttle
7-Bedrock
(To:ssuttle)

All,




if (full != null) for (int k = 0; k < full.getarraysize(); k++) {
fulls.append(full.get(k));
}
par.writeLog(number + " " + norm.getarraysize()); //NOI18N
if (norm != null) for (int k = 0; k < norm.getarraysize(); k++) {
norms.append(norm.get(k));
}



2ND)


if(currTable !=null){


TableCell cell = pfcTable.TableCell_Create(rowNumber, columnNumber);


try{


lines = dwgTable.GetText(cell, ParamMode.DWGTABLE_NORMAL); // throws error when cell is empty


}


catch (XToolkitGeneralError err){


continue;


}


lineText = lines.get(0).toString();


if(lineText.equals(findCellValue)){


//return currTable;//added


break;


}//End of if


}//End of if



3)



Integer.parseInt(cellcol)),
[ ... ]

fulls.append(full.get(k));
I believe that an empty cell will return a stringseq value of null. If
throw a Java NullPointerException. A try/catch block for jxthrowable does
statement that ignores null stringseq values.

Top Tags