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
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.
can somebody tell me what is the cause of the error?
Thanks!
Luar
Solved! Go to Solution.
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
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
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?
Thanks,
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
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
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
Hi Malavika,
Thank you!.,
Last thing, How about if it is a cad file? what type should I choose?
Luar,
Type and Atrribute manager can help find the appropriate name for the CAD object type. Could you please consider doing some reasearch.
-Malavika
Hi Malavika,
Thank you! Yes, I already did, but it confusing me thats why I want to clear.
Thanks,
Luar