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

We are happy to announce the new Windchill Customization board! Learn more.

Using LoadFromFile to bulk load documents

cswaner
5-Regular Member

Using LoadFromFile to bulk load documents

Greetings Gurus,



I am preparing to do yet another bulk load of documents. This time it
is a little different. I need to load not only "Primary Content" for
the document, but I also need to load "Secondary Content" as an
attachment. It is a WTDocument load.



If anyone has done this, it would we greatly appreciated if you could
share the xml syntax.



Thanks in advance,



Cam



Cameron Swaner

MCAD Architect

GE Healthcare



T 801-536-4514

E - <">mailto:->



384 Wright Brothers Drive

Salt Lake City, UT 84116



GE imagination at work <">http://www.gehealthcare.com/worldwide.html>

6 REPLIES 6

Cam, you basically want this, right out of the csvmapfile.txt file:


ContentFile~create~wt.load.LoadContent.createContentFile~user~path

Throw it after whatever you're using to end WTDoc object creation, and it will add the file as an attachment to the doc.

Thanks
Chris
cswaner
5-Regular Member
(To:cswaner)

Thanks Chris, however, I need to clarify. I have simply used the
following to add primary content using LoadFromFile. In this case, the
Document needs both primary and secondary content. I don't see anything
in the csvmapfile that would allow this.



<csvendwtdocument handler="wt.doc.LoadDoc.endCreateWTDocument">

<csvprimarycontenttype>ApplicationData</csvprimarycontenttype>

<csvpath><path to=" the=" content=" file="> </csvpath>

<csvformat></csvformat>

<csvcontdesc></csvcontdesc>

<csvparentcontainerpath></csvparentcontainerpath>








sp-2
1-Newbie
(To:cswaner)

Hi,


If you are trying to add as an attachment, then form the xml like below to load your document:


<csvdocument handler="wt.doc.LoadDoc.createGeneral">


<csvuser>User Name</csvuser>


<csvname>Name</csvname>


<csvtitle>Title</csvtitle>


<csvnumber>Document Number</csvnumber>


<csvtype>Document</csvtype>


<csvdescription>Document Description</csvdescription>


<csvdepartment>Department</csvdepartment>


<csvsavein>Directory or Folder name where you want to save your document</csvsavein> <csvteamtemplate></csvteamtemplate> <csvdomain></csvdomain>


<csvlifecycletemplate>Lifecycle template name</csvlifecycletemplate>


<csvlifecyclestate>Document state in the Lifecycle</csvlifecyclestate>


<csvtypedef>com.ge.appl.Document Type</csvtypedef>


<csvprimarycontenttype>Your Promary content if any</csvprimarycontenttype>


<csvpath></csvpath>


<csvformat></csvformat>


<csvcontdesc></csvcontdesc>


<csvversion>Revision</csvversion>


<csviteration>iteration of the document</csviteration>


<csvsecuritylabels></csvsecuritylabels>


</csvdocument>



<csvloadvalue handler="com.ptc.core.lwc.server.LoadAttValues.loadValue">


<csvname>Type Name</csvname>


<csvreftype></csvreftype>


<csvrefatt></csvrefatt>


<csvvalue>DATA|java.lang.String|Attribute value</csvvalue></csvloadvalue>


<csvendwtdocument handler="wt.doc.LoadDoc.endCreateWTDocument">


<csvprimarycontenttype>ApplicationData</csvprimarycontenttype>


<csvpath>/opt/ptc/Your document which you want to attache with the documnet type</csvpath>


<csvformat></csvformat>


<csvcontdesc></csvcontdesc>


<csvparentcontainerpath></csvparentcontainerpath>


</csvendwtdocument>

Cam,

We do it this way because we use BeginWTDocument, so Sitanshu's might be better for you. But anyway, after you end the csvENDWTDocument tag, then you can throw ContentFile in there.

I know this is old but the answers didn't really explain it to me. I found out by experiment that you can load secondary content with the <csvContentFile> node. I actually use the CSVtoXML facility so my CSV looks like (an example)

#BeginWTDocument,name,title,number,type,description,department,saveIn,teamTemplate,domain,lifecycletemplate,lifecyclestate,typedef,version,iteration,securityLabels

BeginWTDocument,Process Requirements - Coarse Grinding at Point Henry,Process Requirements - Coarse Grinding at Point Henry,229TA001,Document,Process Requirements - Coarse Grinding at Point Henry,DESIGN,/Default/126 Process Plant - Point Henry/229 Coarse Grinding Plant/229 Technical Documents Coarse Grinding Plant/229TA - Technical Requirements Documents Coarse Grinding Plant,,,Regain Life Cycle,RELEASED,local.rs.vsrs05.Regain.TA,B,1,

#EndWTDocument,primarycontenttype,path,format,contdesc,parentContainerPath,,,,,,,,,,

EndWTDocument,ApplicationData,c:\temp\WTDocContent\229TA001-Process-Requirements-Coarse-Grinding-Plant-PH-vB 1.docx,,Finalized Document

#ContentFile,user,path

ContentFile,,c:\temp\WTDocContent\229TA001-Process-Requirements-Coarse-Grinding-Plant-PH-vB 1.pdf

Which generates XML

<NmLoader>

<csvBeginWTDocument handler="wt.doc.LoadDoc.beginCreateWTDocument" >

    <csvname>Process Requirements - Coarse Grinding at Point Henry</csvname>

    <csvtitle>Process Requirements - Coarse Grinding at Point Henry</csvtitle>

    <csvnumber>229TA001</csvnumber>

    <csvtype>Document</csvtype>

    <csvdescription>Process Requirements - Coarse Grinding at Point Henry</csvdescription>

    <csvdepartment>DESIGN</csvdepartment>

    <csvsaveIn>/Default/126 Process Plant - Point Henry/229 Coarse Grinding Plant/229 Technical Documents Coarse Grinding Plant/229TA - Technical Requirements Documents Coarse Grinding Plant</csvsaveIn>

    <csvteamTemplate></csvteamTemplate>

    <csvdomain></csvdomain>

    <csvlifecycletemplate>Regain Life Cycle</csvlifecycletemplate>

    <csvlifecyclestate>RELEASED</csvlifecyclestate>

    <csvtypedef>local.rs.vsrs05.Regain.TA</csvtypedef>

    <csvversion>B</csvversion>

    <csviteration>1</csviteration>

    <csvsecurityLabels></csvsecurityLabels>

</csvBeginWTDocument>

<csvEndWTDocument handler="wt.doc.LoadDoc.endCreateWTDocument" >

    <csvprimarycontenttype>ApplicationData</csvprimarycontenttype>

    <csvpath>c:\temp\WTDocContent\229TA001-Process-Requirements-Coarse-Grinding-Plant-PH-vB 1.docx</csvpath>

    <csvformat></csvformat>

    <csvcontdesc>Finalized Document</csvcontdesc>

    <csvparentContainerPath></csvparentContainerPath>

</csvEndWTDocument>

<csvContentFile handler="wt.load.LoadContent.createContentFile" >

    <csvuser></csvuser>

    <csvpath>c:\temp\WTDocContent\229TA001-Process-Requirements-Coarse-Grinding-Plant-PH-vB 1.pdf</csvpath>

</csvContentFile>

</NmLoader>

The first node creates the WTDocument of subtype local.rs.vsrs05.Regain.TA in our case. The next node attaches the primary content, which is a docx document in our case and the final node creates the secondary content the pdf in our case


The bulk load examples provided by PTC do not really point out that the node <csvEndWTDocument handler="wt.doc.LoadDoc.endCreateWTDocument" > creates the primary and the node <csvContentFile handler="wt.load.LoadContent.createContentFile" > the secondary. I interpreted that you required both nodes for a single primary content (which I now realise was a mistake). It certainly was not clear to me from this article Bulk Loading Documents in Windchill but now that I know it does actually contain all that you require.

Attached little PowerPoint which I made quite a while back may be helpful (specific to a certain lifecycle template - have to adjust for your states).

Top Tags