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

Object Initialization Rules

SOLVED
Highlighted
Level 1

Object Initialization Rules

Hi,

I create a document subtype named "DocsRef" What I'm trying to do is when you create a document under "DocsRef" The default folder shoul be "DOCUMENTS"

I create OIR and this is my code.

<AttributeValues objType="wt.doc.WTDocument">

<AttrValue

id="folder.id"

algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm"

ignore="false"

force="false"

final="false">

<Arg>/wchill://Windchill/Product/Projects/Documents/</Arg>

</AttrValue>

</AttributeValues>


After that I create new rules and named it DocsRef and I choose DocsRef type and upload the xml file with the code above.

When I try to create new document under DocsRef type. I received this error.

Untitled.png

can somebody tell me what is the cause of the error?

Thanks!

Luar

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Object Initialization Rules

Hi Luar,

The exception clearly states that the folder does not exist. Note the folder needs to exist before you create the document and expect to save it in the folder. Consider the OIR entry as shown below :

'Default' needs to exist and the folder ABC is the folder in which I need to store the documents. It is the first level folder.

<AttrValue id="folder.id" algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm">

<Arg>/Default/ABC</Arg>

</AttrValue>

-Malavika

8 REPLIES

Re: Object Initialization Rules

Hi Luar,

The exception clearly states that the folder does not exist. Note the folder needs to exist before you create the document and expect to save it in the folder. Consider the OIR entry as shown below :

'Default' needs to exist and the folder ABC is the folder in which I need to store the documents. It is the first level folder.

<AttrValue id="folder.id" algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm">

<Arg>/Default/ABC</Arg>

</AttrValue>

-Malavika

Re: Object Initialization Rules

Hi Malavika,

Thankyou for prompt response. The error is gone but what I want to do is the path in Select Folder should be the folder path where I want my file to store. Or can I set the radio button default on Auto select Folder?

Untitled.png

Thanks,

Luar

Re: Object Initialization Rules

In the OIR file, you would already have the <AttrConstraint id="folder.id".....

Replace it with the following snippet:

<AttrConstraint id="folder.id" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">

<Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>

<Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/>

</AttrConstraint>

-Malavika

Re: Object Initialization Rules

Hi malavika,

This is my code.

<AttributeValues objType="wt.doc.WTDocument">

<AttrValue

id="folder.id"

algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm"

ignore="false"

force="false"

final="false">

<Arg>/Default/Documents/</Arg>

</AttrValue>

<AttrConstraint id="folder.id" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">

<Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>

<Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/>

</AttrConstraint>

</AttributeValues>

Yes, the radio button on the location is gone and the location is generated. But my problem is even the other type of document it is generated on my "DOCUMENTS" folder. It supposed to be on the DocsRef type only. What am I going to do in my code?.

Thanks!

luar


Re: Object Initialization Rules

Change the line:

<AttributeValues objType="wt.doc.WTDocument">

to contian the name of the soft type

ex:<AttributeValues objType="wt.doc.WTDocument|com.abc.MySoftType">

-Malavika

Re: Object Initialization Rules

Hi Malavika,

Thank you!.,

Last thing, How about if it is a cad file? what type should I choose?

Luar,

Re: Object Initialization Rules

Type and Atrribute manager can help find the appropriate name for the CAD object type. Could you please consider doing some reasearch.

-Malavika

Re: Object Initialization Rules

Hi Malavika,

Thank you! Yes, I already did, but it confusing me thats why I want to clear.

Thanks,

Luar