Skip to main content
1-Visitor
May 4, 2011
Question

Syntax Error Question

  • May 4, 2011
  • 3 replies
  • 2917 views

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

3 replies

5-Regular Member
May 5, 2011

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

1-Visitor
May 9, 2011

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,

17-Peridot
May 9, 2011

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.

1-Visitor
May 10, 2011

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");