Cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot export files using the handler PIE-export-to-plmxmlfile as a subprocess

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

Hi all,

 

I am trying to set up a workflow whereby the user could attach more than one Item Revision as targets and get a xml file with info from its BOM (in case it has one) and the files within the BOMLines contained in that BOM. I would like to get separate xml files and file folders for each of the Item Revisions sent to that workflow.

 

In my first attempt I used the PIE-export-to-plmxmlfile handler (-context=ConfiguredDataFilesExportDefault | -attach=target | -revrule=Precise Only) and realized that only one xml file was created containing all the info I would want as separate xml files and a single folder contained all the exported files. It works fine when sending a single Item Revision to the workflow, but my goal would be to be able to send multiple Item Revisions.

 

To that end, I have tried to define this workflow as a subprocess of another one where using the EMP-create-sub-process handler (-template=previousWFname | -from_attach=Target | -to_attch=Target | -multiple_processes) I am able to send the Item Revisions separatedly to the workflow doing the export. In this case I get separate xml files for each Item Revision, but I am not getting any folder with the files I need to export out of TC.

 

I see this in tcserver*.syslog:

 

INFO - 2019/01/10-12:51:45.500 UTC - TCRSPRUEBA.67370.01.anartz.00497 - PLMXML Export filename is C:\temp\001863_00-00;1-Conjunto Prueba Tracelink del Tracelink:1.plmxml - Teamcenter.Workflow.epm at d:\workdir\tc115w0616_64\src\core\epm\foreign_handlers\pie_workflow_handlers.cxx(281)

...

...

ERROR - 2019/01/10-12:51:46.000 UTC - TCRSPRUEBA.67370.01.anartz.00497 - 23: Fin del archivo en lectura. - FSC_Download error: 23 CURLE_WRITE_ERROR: Error saving data (locally) received on the network connection. - Teamcenter.Organization.sa at d:\workdir\tc115w0616_64\src\core\sa\fscinterface.cxx(1621)

 

And this in tcserver*.fscproxylog:

 

WARNING: FSCClientAgent.download(): http://TCRSPRUEBA:4544/tc/fms/-1911185732/mygroup/FSC_TCRSPRUEBA_Administrador GET failed: 23 CURLE_WRITE_ERROR: Error saving data (locally) received on the network connection.

 

Checking the first line I pasted from syslog I noticed that it is trying to wirte the plmxmlfile with a ':' character in it, something Windows does not allow and that is not entirely true, as the file is being written with a '_' in the place the ':' is supposed to be. My guess is that it is trying to create a folder with the same name, containing the ':', and that is not being able to and, therefore, the files cannot be exported anywhere.

 

Looking the documentation about the EPM-create-sub-process handler I have observed this:

 

 

-process_name= name-of-process

 

....

If the workflow process name is not given, and the -multiple_processes argument is used, the name assigned is in the format of subprocesstargetdisplayname - item-name : count . In this case, that would be item1/A-wheel:1 , item2/B-axle:2 , item3/A-bearing:3 . In the case where the parent had no targets, the name is parentprocess:1 .

 

So I am fearing that my reasoning has been faulty from the beginning and I am not going to be able to achieve what I am looking for. My hope is that as the *.plmxml file has been written on disk replacing the ':' for a '_' there might be a way to achieve that replacement in the folder name as well, but I do not know how I could set that up.

 

Could any of you provide any help or advice, please? Sorry for the long post, I have tried it to be as brief as possible.

 

Anartz 

TC 11.5

 

 

 

 

 

7 REPLIES 7

Re: Cannot export files using the handler PIE-export-to-plmxmlfile as a subprocess

Phenom
Phenom

I can replicate your findings too. Maybe raise a call with GTAC to see if there is a solution if no-one from here can help.

 

The only way I can think of is very complex...  Command line PLMXML_Export delivers what you want....

  • create a new transfermode and attach an xsl stylesheet to it
  • In the workflow run PIE-export-to-plmxmlfile using the new transfermode and the output would be the ID & Rev in a plmxml_export cmd line.  For example:

plmxml_export -u= -p= -g= -item=000101 -rev=00 -transfermode=ConfiguredDataFilesExportDefault -xml_file=000101_00.xml

plmxml_export -u= -p= -g= -item=000102 -rev=00 -transfermode=ConfiguredDataFilesExportDefault -xml_file=000102_00.xml

 

  • Next task in Workflow EPM-run-external-command, which calls a script which either divides the export xml into individual bat files with a for each to run them, or a script that saves a copy of the output as a bat file, and then just run the 1 file.
  • At the end have a move command to move the bat files and plmxml to an Archive folder.

Like I said, a very complex workaround!

 

edit....

I had an xsl doing something similar.  Below is a quick stab at what you would need.  I havent tested it, but I'm pretty confident its right:

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:plm="http://www.plmxml.org/Schemas/PLMXMLSchema"
xmlns:crf="http://ExternalFunction.setFile"
xmlns:msxsl="http://exslt.org/common"
xmlns:str="http://exslt.org/strings">

<xsl:output method="text" omit-xml-declaration="yes" indent="no"/>

<xsl:template match="/">
<xsl:for-each select="plm:PLMXML/plm:ProductRevision">
<xsl:call-template name="plmxml_export">
</xsl:call-template>
</xsl:for-each>
</xsl:template>

<xsl:template name="plmxml_export">
<!-- We want to build a command line that looks like
plmxml_export -u= -p= -g= -item=000101 -rev=00 -transfermode=ConfiguredDataFilesExportDefault -xml_file=000101_00.xml -->
<xsl:text>plmxml_export -u= -p= -g= -item=</xsl:text>
<!-- Outputs the Item ID -->
<xsl:variable name="ID" select ="..//plm:UserValue[@title='item_id']/@value"/>
<xsl:value-of select="$ID"/>
<xsl:text> -rev=</xsl:text>
<!-- Outputs the Revision No -->
<xsl:variable name="REV" select ="..//plm:UserValue[@title='item_revision_id']/@value"/>
<xsl:value-of select="$REV"/>
<xsl:text>-transfermode=ConfiguredDataFilesExportDefault -xml_file=</xsl:text>
<xsl:value-of select="$ID"/>
<xsl:text>_</xsl:text>
<xsl:value-of select="$REV"/>
<xsl:text>&#10;</xsl:text>
</xsl:template>
</xsl:stylesheet>

Rich

Richard Bennett
PLM Consultant
www.ProspectPLM.co.uk

Re: Cannot export files using the handler PIE-export-to-plmxmlfile as a subprocess

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

Thank you Richard!! I opened an IR earlier this morning and we'll have to wait for news from that side too, but the workaround you propose seems promising!! I'll give it a go monday morning and I'll let you know what I get.

 

Anartz

Re: Cannot export files using the handler PIE-export-to-plmxmlfile as a subprocess

Phenom
Phenom
I tested further with 3 different revisions, but the xsl exported the same 3 lines. But the xml without the xml definitely had the 3 different revisions. The xsl just needs a but if work.

You can set the -file = export.bat, so then you just need the final bat file to call the exported .bat file.

Get Outlook for Android
Richard Bennett
PLM Consultant
www.ProspectPLM.co.uk

Re: Cannot export files using the handler PIE-export-to-plmxmlfile as a subprocess

Phenom
Phenom

Attached is a working xsl file.

You need a transfermode which has a Closure rule and Property Set which looks something like:

Capture.JPG

Capture.JPG

The workflow handler arguments:

Capture.JPG

 

The command to upload the xsl and attach it to the transfermode:

plmxml_tm_edit_xsl -u=infodba -p=infodba -g=dba -transfermode=IE_Revision_Export_PLMXML -action=attach -xsl_file=IE_Revision_Export_PLMXML.xsl

The result is a plmxml.bat file which looks like:

Capture.JPG

You just need a bat file to run the exported plmxml.bat file now and to call it from the workflow.

Note - after attaching the xsl to the transfermode you may need to restart your client for the changes to take effect.  Also, I have used infodba as its a Test system.  I wouldnt normally use this user!

Rich

Richard Bennett
PLM Consultant
www.ProspectPLM.co.uk
Highlighted

Re: Cannot export files using the handler PIE-export-to-plmxmlfile as a subprocess

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

Richard, thanks so much for taking the time and effort in helping me out with this. It's been a tough monday and I just had the chance to take a breather and try your solution. I am sorry to report that I am not being able to attach the *.xsl file to the transfermode using the command you mention in your post...

 

I attach an image of the error message.

 

Kind Regards,

 

Anartz

Re: Cannot export files using the handler PIE-export-to-plmxmlfile as a subprocess

Phenom
Phenom

close your Teamcenter client, and try again.  The client sometimes puts a lock on the transfermode.

Rich

Richard Bennett
PLM Consultant
www.ProspectPLM.co.uk

Re: Cannot export files using the handler PIE-export-to-plmxmlfile as a subprocess

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter

I was copy/pasting the command line directly from your post and it kept failing. I tried to type it from scratch and succeeded!! I guess it was related to the '-' character, if I am not wrong there are multiple dash-like characters that can be easily mistaken one for another.

 

Thanks a lot Rich, I will go on with the next steps over the next few days. I will keep you posted ;)

 

Anartz