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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Syntax Error Question

MichaelWright
1-Newbie

Syntax Error Question

I feel like I'm beating my head against a wall trying to figure this out. Here is the Error I'm receiving

Checking Syntax...
E:\ptc\Windchill_9.1\Windchill\temp\WfExpression106259384.java:52: ';' expected
WTDocument wt.doc.WTDocument = (WTDocument) context [17];
^
1 error
Syntax check complete.

Here is the code that I'm working with:

wt.fc.QueryResult qr = null;
qr = wt.doc.WTDocument((RCTestRequest)primaryBusinessObject);
wt.doc.WTDocument cn = (RCTestRequest)qr.nextElement();
qr = null;
qr = wt.doc.WTDocument(cn);
wt.doc.WTDocument cr = (RCTestRequest)qr.nextElement();
ext.generic.util.IBAUtil objHelper = new ext.generic.util.IBAUtil(cr);
ProjectEngineer=objHelper.getIBAValue("ProjectEngineer");
Samples=objHelper.getIBAValue("Samples");
TestReportFormat=objHelper.getIBAValue("TestReportFormat");
Number=objHelper.getIBAValue("Number");
FunctionalGroup=objHelper.getIBAValue("FunctionalGroup");
ProductDescription=objHelper.getIBAValue("ProductDescription");
ProductName=objHelper.getIBAValue("ProductName");

If someone could help me understand what this Error means, I would greatly appreciate it. I am almost at a complete loss when it comes to Java Syntax, so simple terms for an explanation please.

Thanks,

Michael

4 REPLIES 4
ChrisWatson
5-Regular Member
(To:MichaelWright)

Well that particular line is 2 many WTDocuments:

WTDocument wt.doc.WTDocument = (WTDocument) context [17];

Should be:

wt.doc.WTDocument doc = (WTDocument) context [17];

Where doc is a suitable attribute name.

But to be honest the rest of the code won't work either:

qr = wt.doc.WTDocument((RCTestRequest)primaryBusinessObject);

and

qr = wt.doc.WTDocument(cn);

Shouldn't compile since qr isn't a super-class of WTDocument (assuming RCTestRequest is a sub-class).

Chris

I know nothing about doing this to be honest with you and am having trouble finding anyone that does. Do you happen to have any information that could help me in compiling an execute expression to pull those attributes from a WTDocument? Thanks,

Michael, try this:

wt.doc.WTDocument wtdoc=(wt.doc.WTDocument)primaryBusinessObject;
wt.iba.definition.litedefinition.StringDefView def;
def= (wt.iba.definition.litedefinition.StringDefView)wt.iba.definition.service.IBADefinitionHelper.service.getAttributeDefDefaultViewByPath("your_attribute's_logical_id_here");
wtdoc = (wt.doc.WTDocument)wt.iba.value.service.IBAValueHelper.service.refreshAttributeContainer(wtdoc, null, null, null);
wt.iba.value.DefaultAttributeContainer dac = (wt.iba.value.DefaultAttributeContainer)wtdoc.getAttributeContainer();
wt.iba.value.litevalue.AbstractValueView[] avv = dac.getAttributeValues(def);

if(avv != null)
{

wt.iba.value.litevalue.StringValueDefaultView svdv = (wt.iba.value.litevalue.StringValueDefaultView)avv[0];
String atr=svdv.getValue();

//puts attribute's value to your workflow variable

ttt2="itworks= "+atr;
}

This is for string attributes. Change StringDefView to IntegerDefView or FloatDefView for Integer and Float.

I was able to get it fixed with this bit of coding. Finally started understanding some of the errors I was getting and through trial and error, I pulled this out and this is exactly what I want it to do. Thanks for your help guys.

wt.fc.QueryResult qr = null;

wt.doc.WTDocument RCTestRequest=((wt.doc.WTDocument)primaryBusinessObject);

ext.generic.util.IBAUtil objHelper = new

ext.generic.util.IBAUtil(RCTestRequest);

ProjectEngineer=objHelper.getIBAValue("ProjectEngineer");

Samples=objHelper.getIBAValue("Samples");

Top Tags