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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Object Initialization Rules

Luar
1-Visitor

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

ACCEPTED SOLUTION

Accepted Solutions
mrane
12-Amethyst
(To:Luar)

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

View solution in original post

8 REPLIES 8
mrane
12-Amethyst
(To:Luar)

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

Luar
1-Visitor
(To:mrane)

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

mrane
12-Amethyst
(To:Luar)

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

Luar
1-Visitor
(To:mrane)

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


mrane
12-Amethyst
(To:Luar)

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

Luar
1-Visitor
(To:mrane)

Hi Malavika,

Thank you!.,

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

Luar,

mrane
12-Amethyst
(To:Luar)

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

-Malavika

Luar
1-Visitor
(To:mrane)

Hi Malavika,

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

Thanks,

Luar

Announcements


Top Tags