8 Replies Latest reply on May 16, 2012 8:35 AM by Michael Dekoning

    Mapping variables to HTML values?

    Daan van Boggelen

      Hi, I'm currently working on an ECN workflow, and i want to use ECN documents in HTML format (for opening speed reasons).

       

      I believe this can be done by mapping a variable to custom properties from the HTML file.. but here comes the problem: i have no clue about the block names, attribute names etc. i need to use.

       

      I have tried to use the same strategy as for xml docs, but no result for html..

       

      I found this video from Justin Webster, and i believe he does exactly the thing i want!

      http://blog.inflow-tech.com/inflow/2009/10/solidworks-enterprise-pdm-ecn-process.html

       

      Anybody got experience with this matter?

       

      any help would be highly appreciated!

        • Re: Mapping variables to HTML values?
          Joy Garon

          Hi William -

           

          Just to save you some time...you cannot map properties to HTML ala XML. (I asked the same question)

          I'm not positive, but, I think InFlow is using an add-in to accomplish what you see in the video).

          I would suggest you contact InFlow directly.

           

          Regards,

          Joy

          • Re: Mapping variables to HTML values?
            Michael Dekoning

            Willem,

             

            Glad that Joy replied to you. I thought that you couldn't map attributes to HTML files but wasn't certain. For our ECOs I'm using XML along with an XSL stylesheet so that the preview looks like an HTML file. I even created links to view the files listed in the ECO (that's why I'm storing the fileid & folderid). The technique is pretty straightforward.

             

            For example my ECO xml file contains this:

             

            <?xml version="1.0" encoding="utf-8"?>
            <?xml-stylesheet type='text/xsl' href='C:\VAULT\TEMPLATES\eco.xsl'?>
            <Eco Number="ECO-0000017">
            <Author>Mike DeKoning</Author>
            <Created>07/05/2010</Created>
            <Filelist>
            <File FileId="207021" FolderId="3866" Filename="AW010001.DWG"  />
            <File FileId="207025" FolderId="3866" Filename="AW010002.DWG"  />
            </Filelist>
            </Eco>

             

            The eco.xsl file which is in the TEMPLATES folder conatins this:

             

            <?xml version='1.0' encoding="UTF-8"?>
            <xsl:stylesheet version="1.0"
              xmlns:xsl="
            http://www.w3.org/1999/XSL/Transform">

              <xsl:template match="/">
                <HTML>
                <STYLE>
                A {text-decoration:none}
                </STYLE>
                  <BODY>
                        <H1>Engineering Change Order</H1>
                        <xsl:apply-templates/>
                  </BODY>
                </HTML>
              </xsl:template>         
             
               <xsl:template match="/Eco">

              <TABLE cellspacing="0" cellpadding="2" width="300">

                      <TR>
                        <TD Colspan="2"><b>ECO Number: </b> <xsl:value-of select="@Number"/></TD>
                      </TR>
                      <TR>
                        <TD><b>Requestor: </b> <xsl:value-of select="Author"/></TD>
                        <TD><b>Date: </b> <xsl:value-of select="Created"/></TD>
                      <TR>
                        <TD Colspan="2"><b>Affected Drawings:</b></TD>
                      </TR>          
                      </TR>
                         <xsl:apply-templates select="Filelist" />
                    </TABLE>
            </xsl:template>
              <xsl:template match="Filelist">
                <xsl:apply-templates />
              </xsl:template> 
              <xsl:template match="File">
              <TR>
                          <TD Colspan="2">
                          <A><xsl:attribute name="href">conisio://VAULT/view?projectid=<xsl:value-of select="@FolderId"/>&amp;documentid=<xsl:value-of select="@FileId"/>&amp;objecttype=1</xsl:attribute>
                          <xsl:value-of select="@Filename"/></A></TD>
                          </TR>
              </xsl:template>
            </xsl:stylesheet>

             

            The preview shows the following:

            eco.png

            Mike

            EPDM 2010 SP2

            • Re: Mapping variables to HTML values?
              James Lazar

              I know this is rather old, but this is exactly what I am trying to do!  Any updates on if this is possible?

                • Re: Mapping variables to HTML values?
                  Michael Dekoning

                  James,

                   

                  No, you can't update variables in an html file. You can map to an xml file as shown above, then use a xsl stylesheet file to transform it into an html file.

                    • Re: Mapping variables to HTML values?
                      James Lazar

                      Wow thanks for the quick reply!  You can see my other thread for specifically what I am attempting to do.

                       

                      So this would work in the following manner:

                      1.  Use a template card to create a new xml file based on a template xml file.  This template card will have a text box that is attached to, say, variable "ECN_Description".  The template will convert this to a template variable "t_ECN_Description"

                      2.  In the XML file we'll have, say, the following:

                       

                      <ECN>

                           <Description>%t_ECN_Description%</Description>

                      </ECN>

                       

                      I would have the variable "ECN_Description" mapped to the block "xml" and the attribute "ECN/Description".

                      3.  When the template card is submitted with the data "XYZ" entered in the text field, it autopopulates %t_ECN_Description% to "XYZ".  The variable "ECN_Description" that is mapped to that element also receives the value "XYZ".

                      4.  A text field in the data card is tied to the variable "ECN_Description" which populates the text field in the data card with "XYZ".  The entered information is now populated in both the XML and data card, and any future changes to the data card will result in a change of the value in the XML file.

                       

                      The XSL file would just format the XML file to look like an html file, but would retain its xml file extension, correct?

                       

                      Is this correct or am I missing something here?  I haven't done much with either XML or variable mapping in the past so I want to make sure I'm getting this right.

                       

                      EDIT:  I did this and got it to work wonderfully!  Now I just need to make the XSL file to format it and add in all of the other data.  Thanks so much!