7 Replies Latest reply on Jul 7, 2011 7:28 AM by Andries Koorzen

    Changing Variables using IEdmEnumeratorVariable5::SetVar for Viewers

    Kent Keller

      I have several viewers that need to have variable only access (Not file editing ability).  In my Addin, in order to update variables, the setvar function needs the file to be checked out.  This is not required in normal workflow transitions.

       

      Note: In "Out of the Box" workflow, I can set up transitions that will update variables when a "Viewer" user changes the workflow state.

       

      Is it possible in API, to set variables from a "Viewer" login like you can in "Out of the Box" Workflow Transistions?

       

      Seems to me that setting variables should not require checkout abilities

       

      Kent

        • Re: Changing Variables using IEdmEnumeratorVariable5::SetVar for Viewers
          Wayne Matus

          I never tested a viewer license, but I thought that a viewer could not change states or check out files. I thought the only thing they could do was open files read only for viewing and printing, could not participate in workflows..

            • Re: Changing Variables using IEdmEnumeratorVariable5::SetVar for Viewers
              Kent Keller

              We have tested it as viewer.  If there are variables set on workflow transition, it changes them, versions the file and history shows "Cheked in"

               

              Viewers can participate in workflows.

               

              Kent

                • Re: Changing Variables using IEdmEnumeratorVariable5::SetVar for Viewers
                  Wayne Matus

                  I learned two things today,. first a viewer license can change state of a file. I was under the impression from people at SolidWorks that you needed Contributor license to move files through a workflow. The Installation Guide does not go into enough detail on the capabilities of each client type.

                  EPDM Clients.png

                  I assume enhanced management means changing workflow states. Viewer definitely says it cannot update values and Kent, you say that it allows you to change states where transition is updating variables. Are these variables mapped to file properties? If so it would have to update values for sure. Even if they are not mapped, it still has to create a new version of the file. Not sure how EPDM does that and would like to know. Since the file itself does not change, only the database. Does it just copy the file in the vault to create a new version (speeding up the state change) or does it copy the file in the local view to create the new version.

                   

                  Anyway, I am guessing that you uncovered an "Oops" in the program that lets you do something that was not intended for you to do, but the API is as intended. You would have to verify that with your VAR.

                   

                  The other thing I learned is that you can change the license type on a client computer without having to modify the install. In your Administration Tools, Help -> About SolidWorks Enterprise PDM Administration, there is a drop down list to allow you to puck the client type. When you change the type, it will warn you that you will need to reboot, but all you have to do is logoff the computer and log back in.

                    • Re: Changing Variables using IEdmEnumeratorVariable5::SetVar for Viewers
                      Kent Keller

                      Actually, all you have to do to change license dynamically is three things

                      1. Set a registry value

                           HKEY_LOCAL_MACHINE\SOFTWARE\SolidWorks\Applications\PDMWorks Enterprise\PTID

                           {E2BE88CF-6E17-43e2-A837-C1051F3E4EDB} = Contributor

                           {05AD35C4-8A9A-4114-B51F-32186222ABA1} = Editor (CAD)

                           {CC72DD26-1A34-4209-B50B-21C7DD5E29F6} = Viewer

                      2. Stop EDMServer.exe (and restart it if you still want you little icon in the task bar)

                      3. Restart Explorer.exe

                       

                      No reboot is required.  I have a script that we run to do this.

                       

                      Kent

                      • Re: Changing Variables using IEdmEnumeratorVariable5::SetVar for Viewers
                        Kent Keller

                        You could be right about the workflow "oops".  However, it seems that no new version of the file is actually saved.  Only a new version for variable purposes.  Apparently, when no physical file is changed the new version uses the last physical version from the vault.  So vault versions are not saved for every single EPDM version.  Confused yet?

                         

                        Kent

                          • Re: Changing Variables using IEdmEnumeratorVariable5::SetVar for Viewers
                            Wayne Matus

                            You are right about that new version thing. There is an index.xml file in the actual vault for each file. This index.xml file maps versions to actual files in the vault. Here is the xml file from a test file.

                             

                            <?xml version="1.0"?>
                            <index version="9.0"><filename>New Text Document.txt</filename><version id="1" date="2011-07-01 17:30:36"/><version id="2" date="2011-07-01 17:31:34"/><version id="3" ref="2" date="2011-07-01 17:31:36"/></index>

                             

                            Version 1 and 2 are actual versions. Verrsion 3 was where I just updated a variable on the card. The variable was not mapped to any file properties, so no new version of the file was created. The index.xml file says that version id 3 ref 2.

                             

                            Thanks for your input.

                    • Re: Changing Variables using IEdmEnumeratorVariable5::SetVar for Viewers
                      Andries Koorzen

                      Hi Wayne / Kent

                       

                      I am part of a reseller (FYI)

                       

                      1. You can change client status by going to the administration tool -> Help -> About Enterprise PDM -> Change from viewer -> contributor -> Editor

                          This setting will change the client type on the machine, provided that you installed the highest level of client (e.g if you only installed a viewer, you cannot change to an editor since the editor addin for SW has not been installed. However, if you install editors on all machines, and then change the settings to that of a viewer... no problem)

                       

                      2. Viewers can take part in a workflow yes. It has always been like this. The person viewing the file can approve it by moving it through the appropriate states, but they cannot check out / check in a file.. .hence they can not edit it / commit new files to the vault.

                       

                      3. To set variables for viewers, use Transitions / the workflow. The API will not allow you to check out a file (otherwise everyone would just buy viewers and script the heck out of it!! since they're so much cheaper!) and you are correct in saying that in normal workflow this is not required, but in a normal workflow, it is actually a complex SQL query that runs in the background that updates the values, and not an API call.

                      Theoretically you should be able to do the same thing with EPDM / SQL queries, but please bear in mind that altering you database in any way will void any support from your VAR / SolidWorks!! NB!!

                       

                      Hope this helps