Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Solved! Go to Solution.
Hi @K_Patil
What Windchill version do you use?
btw, where the variable partName is defined?
Do you define this variable in the workflow variable? if so, then you can not define it again in your code.
If I create global workflow variable, then I get same error as you.
if the variable is defined as a global then you can not define it again.
instead of wt.vc.views.View partName = ........
use just partName = (wt.vc.views.View) part.getView().getObject();
PetrH
Hi @K_Patil
Check the name of variable, it can not be same as the defined object wt.vc.views.View view
the error tells you that you have two declarations of the same variable and it can not be used.
PS> the view variable is a object type wt.vc.views.View so you can not compare the vale to a string "Design" that way as you try.
you can compare two strings not String with wt.vc.views.View. Try to use view.getName();
PetrH
Hi @HelesicPetr ,
I tried to adopt it, but it is still the same.
======
if (primaryBusinessObject instanceof wt.part.WTPart) {
wt.part.WTPart part = (wt.part.WTPart) primaryBusinessObject;
wt.vc.views.View partName = (wt.vc.views.View) part.getView().getObject();
if (partName != null && "Design".equals(partName.getName())) {
result = "Go";
} else {
result = "NoGo";
}
}
====================
Checking Syntax...
warning: Supported source version 'RELEASE_7' from annotation processor 'com.microsoft.azure.management.apigeneration.LangDefinitionProcessor' less than -source '1.8'
WfExpression_1315495121.java:129: error: variable partName is already defined in method executemethod_1(Object[],Object[])
wt.vc.views.View partName = (wt.vc.views.View) part.getView().getObject();
^
Note: WfExpression_1315495121.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
1 warning
Syntax check complete.
can you please check ?
Hi @K_Patil
What Windchill version do you use?
btw, where the variable partName is defined?
Do you define this variable in the workflow variable? if so, then you can not define it again in your code.
If I create global workflow variable, then I get same error as you.
if the variable is defined as a global then you can not define it again.
instead of wt.vc.views.View partName = ........
use just partName = (wt.vc.views.View) part.getView().getObject();
PetrH