6 Replies Latest reply on Oct 8, 2010 4:36 PM by Vlad Krylov

    API Access to Lists (for cards)

    Michael Dekoning

      Is there an interface in the API to gain access to the Lists (for cards) in EPDM? I can't believe there's not one but I sure can't find it.

       

      Mike

      EPDM 2010 SP2

        • Re: API Access to Lists (for cards)

          I do not see anything in the API help file either. Guess you will have to run SQL query on database. The two tables are CardLists and CardListValues.

          • Re: API Access to Lists (for cards)
            Belinda Flynn

            Yeah, I need to be able to extract a customer code from my customer list to populate the data card. The only why I have found to do this is to nest the variable for customer code within the pulldown box for customer name.  But I was told this could be done using an API, so if you have come across anything that can make displaying the cust code when we choose customer name, please let me know.?

             

            We are using PDMWE 2009, Sp 4.0.

              • Re: API Access to Lists (for cards)
                Michael Dekoning

                Belinda,

                 

                What I'm looking for is a way to get the values in a list using the API instead of using a SQL query. If I understand what you want, the new Text with Alias type in EPDM 2011 may help you. See page 13 in the What's New guide for EPDM 2011.

                 

                Mike

                EPDM 2010 SP2

                  • Re: API Access to Lists (for cards)
                    Vlad Krylov

                    Have not tried it, but one of the hooks you can add is EdmCmd_CardLstSrc. Here is an excerpt from the Programmer's guide:

                     

                    EdmCmd_CardListSrc

                    A file or  folder data card containing a list box or combo box is displayed. The add-in’s OnCmd method is given the  opportunity to fill-in the rows in the list instead of using the list contents  defined in the card editor.

                     

                    This hook  is introduced in SolidWorks Enterprise PDM  6.0.

                     

                    Members

                    Type

                    Description

                    mlObjectID1

                    long

                    ID of the  card control.

                    mlObjectID2

                    long

                    ID of the  file (zero for folder cards).

                    mlObjectID3

                    long

                    ID of the  folder.

                    mlObjectID4

                    long

                    ID of the  card.

                    mbsStrData1

                    BSTR

                    Name of the  active configuration.

                    mbsStrData2

                    BSTR

                    Full path  to the file.

                    mbsStrData3

                    BSTR

                    The name of  the control’s variable.

                    mlLongData1

                    long

                    ID of the  control’s variable.

                    mpoExtra

                    IDispatch*

                    Pointer to  an IEdmStrLst5 interface with all configuration  names.

                     

                    Note: You will also receive a pointer to  the IEdmEnumeratorVariable5 and IEdmCard5 interfaces via the EdmCmd::mpoExtra argument. The contents of the EdmCmd::mbsComment member is the return value  from your OnCmd implementation. This variable should  be set to a newline-delimited list of strings to be  inserted into the list box or combo box. Leave this variable untouched to use  the standard values from the card editor.

                  • Re: API Access to Lists (for cards)

                    It can be done prior to 2011, but it is ugly and not flexible. You can use the imput formula to in effect create a big if statement The syntax of the imput formula is

                     

                    %ListVariableName(ListVariableValue=EditBoxVariableValue, ListVariableValue=EditBoxVar5iableValue)%

                     

                    The separator in the formula is a comma, so your Customer Name cannot have a comma in it. The values has to match, so typos can cause problems. If you add Customer Names to the list you will have to edit the formula at add them.

                     

                    List.png