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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Simple (I think) question on where clauses - sent too soon

avillanueva
22-Sapphire II

Simple (I think) question on where clauses - sent too soon



I've been through the guides, can't seem to find an example of where
clause other than single clause. I am using dca-Query.xml and want to
find WTParts by a number, view and that are the latest version. Here is
my code:

task.addParam("search_type", "wt.part.WTPart"); //should get WTPart

task.addParam("where",
"number="+topLevelWTPart+",isLatestVersion="+"true"); //WTPart number

Task seems to indicate that where can have multiple entries and is comma
delimited.

<ie:param name="type" data="${@FORM[]search_type[]}"/">

<ie:param name="where" data="${@FORM[]where[*]}"&lt;br"/>delim="," default="()"/>

Does someone have an example of multiple where expressions? What about
AND and OR expressions?

I looked up the logical names and it does show that isLatestVersion is
available but returned following message.

com.infoengine.util.IEException:
com.ptc.core.meta.common.impl.LogicalAttributeFormatException: Unable to
find logical a

ttribute: "isLatestVer.id with context: "WCTYPE|wt.part.WTPart"

Nested exception is:
com.ptc.core.meta.common.impl.LogicalAttributeFormatException: Unable to
find logical attribute: "i

sLatestVer.id with context: "WCTYPE|wt.part.WTPart"; nested exception
is: com.ptc.core.command.common.CommandException:

com.ptc.core.meta.common.impl.LogicalAttributeFormatException: Unable
to find logical attribute: "isLatestVer.id with c

ontext: "WCTYPE|wt.part.WTPart"

Nested exception is:
com.ptc.core.meta.common.impl.LogicalAttributeFormatException: Unable to
find logical attribute: "i

sLatestVer.id with context: "WCTYPE|wt.part.WTPart"

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)

at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at
com.infoengine.procunit.IEExceptionUtil.checkCollectionForErrors(IEExcep
tionUtil.java:137)

at
com.infoengine.procunit.IEExceptionUtil.checkCollectionForErrors(IEExcep
tionUtil.java:34)

at com.infoengine.SAK.Task.executeTaskRemotely(Task.java:2069)

at com.infoengine.SAK.Task.invoke(Task.java:1713)



Thanks in advance for any pointers.

5 REPLIES 5
avillanueva
22-Sapphire II
(To:avillanueva)

One piece solved, it is a comma separator.

task.addParam("where",
"number="+topLevelWTPart+",view.id="+"wt.view.View:1447");



Also needed to provide ID for view in that format.


Hi Antonio,

Try using
& for AND
| for OR

Regards,

Murugesh

On Fri, Sep 23, 2011 at 10:07 PM, Villanueva, Antonio <
-> wrote:

> One piece solved, it is a comma separator.****
>
> task.addParam("where", "number="+topLevelWTPart+",view.id
> ="+"wt.view.View:1447");****
>
> ** **
>
> Also needed to provide ID for view in that format.****
>
> ** **
avillanueva
22-Sapphire II
(To:avillanueva)

RTFM - 3-3 of WC Adapter Guide for Where clause syntax


Antonio, did you ever figure out the isLatestVersion issue in the where clause? I'm able to use it as an attribute to return, but not in my Where clause.


My error is identical to what you have in my infoengine task.




<%@page language="java" session="false"%>

<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>


<ie:webject name="Get-Properties" type="MGT">

<ie:param name="AUTHORIZATION" data="${@SERVER[]authorization[]}"/">

<ie:param name="ATTRIBUTE" data="wt.federation.ie.VMName"/">

<ie:param name="GROUP_OUT" data="properties"/">

</ie:webject>


<ie:webject name="Query-Objects" type="OBJ">

<ie:param name="INSTANCE" data="${properties[0]wt.federation.ie.VMName[0]}" valueseparator=";" delim=";"/>

<ie:param name="ATTRIBUTE" data="obid,number,isLatestVersion,name,lifeCycleTemplate.name,containerName,iterationInfo.latest" delim=","/">

<ie:param name="TYPE" data="wt.part.WTPart"/">

<ie:param name="WHERE" data="isLatestVersion.id=true"/">

<ie:param name="GROUP_OUT" data="myQuery"/">

</ie:webject>




Thx


Steve D.



In Reply to Antonio Villanueva:




I've been through the guides, can't seem to find an example of where
clause other than single clause. I am using dca-Query.xml and want to
find WTParts by a number, view and that are the latest version. Here is
my code:

task.addParam("search_type", "wt.part.WTPart"); //should get WTPart

task.addParam("where",
"number="+topLevelWTPart+",isLatestVersion="+"true"); //WTPart number

Task seems to indicate that where can have multiple entries and is comma
delimited.

<ie:param name="type" data="${@FORM[]search_type[]}"/">

<ie:param name="where" data="${@FORM[]where[*]}"&lt;br"/>delim="," default="()"/>

Does someone have an example of multiple where expressions? What about
AND and OR expressions?

I looked up the logical names and it does show that isLatestVersion is
available but returned following message.

com.infoengine.util.IEException:
com.ptc.core.meta.common.impl.LogicalAttributeFormatException: Unable to
find logical a

ttribute: "isLatestVer.id with context: "WCTYPE|wt.part.WTPart"

Nested exception is:
com.ptc.core.meta.common.impl.LogicalAttributeFormatException: Unable to
find logical attribute: "i

sLatestVer.id with context: "WCTYPE|wt.part.WTPart"; nested exception
is: com.ptc.core.command.common.CommandException:

com.ptc.core.meta.common.impl.LogicalAttributeFormatException: Unable
to find logical attribute: "isLatestVer.id with c

ontext: "WCTYPE|wt.part.WTPart"

Nested exception is:
com.ptc.core.meta.common.impl.LogicalAttributeFormatException: Unable to
find logical attribute: "i

sLatestVer.id with context: "WCTYPE|wt.part.WTPart"

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)

at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at
com.infoengine.procunit.IEExceptionUtil.checkCollectionForErrors(IEExcep
tionUtil.java:137)

at
com.infoengine.procunit.IEExceptionUtil.checkCollectionForErrors(IEExcep
tionUtil.java:34)

at com.infoengine.SAK.Task.executeTaskRemotely(Task.java:2069)

at com.infoengine.SAK.Task.invoke(Task.java:1713)



Thanks in advance for any pointers.

Steve,



<ie:param name="ATTRIBUTE"&lt;br"/>data="obid,number,isLatestVersion.id,name,lifeCycleTemplate.name,containerNa
me,iterationInfo.latest" delim=","/>



Does that make a difference at all, adding the .id in attribute field?
isLatestVer.id is different from what you show here.



If not, did you check to see if this is indeed a logical attribute and not a
computed? It may only be trying to look at what is in LogicalAttributes.xml
or a persisted attribute. A search objects webject might be quicker? If not
you can add a custom logical attribute in the xml file for version sort id
to persistable as highest against that master?





- Dave






Announcements


Top Tags