Skip to main content
17-Peridot
October 24, 2019
Question

What type should be the variable obj ?

  • October 24, 2019
  • 2 replies
  • 4172 views

Hello, please tell me what type should be the variable obj ? I found an example of editing a template https://www.ptc.com/en/support/article?n=CS150777 , but there was a problem with the type of variable, tried everything I knew and everything that was recommended, it did not work to pass the test.

 

CODE:

​wt.maturity.PromotionNotice notice = (wt.maturity.PromotionNotice)primaryBusinessObject;
                 wt.fc.QueryResult results = wt.maturity.MaturityHelper.service.getPromotionTargets(notice);
                 while (results.hasMoreElements())
                  {
                          obj = results.nextElement();
                          if (obj instanceof wt.doc.WTDocument)
                          {                                 
         var += obj.getName ()+“,”;         // var  is a global variable
                          }
                     }

 

TESTING:

Checking Syntax...
warning: Supported source version 'RELEASE_7' from annotation processor 'com.microsoft.azure.management.apigeneration.LangDefinitionProcessor' less than -source '1.8'
WfExpression_11.java:57: error: incompatible types: Object cannot be converted to Persistable
obj = results.nextElement();
^
Note: WfExpression_11.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
1 warning

Syntax check complete.

2 replies

12-Amethyst
October 24, 2019

Didn't the reply by @zsternal-2 in this thread help?

12-Amethyst
October 24, 2019

Ok sorry, just saw your reply there. I think there is something wrong with your code. Is this what you wrote after the suggestion from @zsternal-2 

wt.fc.Persistable persistable = (wt.fc.Persistable) resulting.nextElement();

 

If yes, and it did not work, please post the full code.

 

 

VladiSlav17-PeridotAuthor
17-Peridot
October 24, 2019

 

@yadavankur, unfortunately the answer did not help, the error is the same, already many types tried