3 Replies Latest reply on May 16, 2012 11:38 AM by Jim Sculley

    API: Method "Getvar" of a IEdmBomCell object of a derived BOM

    Giuseppe Ceccherini

      Hi all,

      i'm using Enterprise PDM 2011 sp5.

      I noticed that the method GetVar of a IEdmBomCell of a derived Bom (that is from "GetDerivedBOMs" method) return always an empty string.

      that is a real big problem to me.

      anybody knows if this is a bug?

       

      at the bottom the code (c#) where i try to read a derived BOM. thanks in advance.

       

      string _bomName = "A1.SLDASM.1.BOM";

                      EdmBomView _bomView;

                      Array _boms;

                      m_File.GetDerivedBOMs(out _boms);

                      if (_boms.Length > 0)

                      {

                          foreach (EdmBomInfo _bomInfo in _boms)

                          {                       

                              EdmBom _bom = (EdmBom)m_Vault.GetObject(EdmObjectType.EdmObject_BOM, _bomInfo.mlBomID);

                              if (_bomName.ToUpper() == _bom.Name.ToUpper())

                              {

                                  _bomView = _bom.GetView(_bom.CurrentVersion); ;

                                  Array _rows;

                                  _bomView.GetRows(out _rows);

                                  if (_rows.Length > 0)

                                  {

                                      Array _columns;

                                      _bomView.GetColumns(out _columns);

                                      foreach (IEdmBomCell _cell in _rows)

                                      {

                                          foreach (EdmBomColumn _col in _columns)

                                          {

                                              object _poValueObj; object _poComputedValueObj; string _conf; bool _ro;

                                              _cell.GetVar(_col.mlVariableID, _col.meType, out _poValueObj, out _poComputedValueObj, out _conf, out _ro);

                                          }                                                                       

                                      }

                                  }

                              }

                          }

                      }

        • Re: API: Method "Getvar" of a IEdmBomCell object of a derived BOM
          Jim Sculley

          There doesn't seem to be anything wrong with the code.  It works on my machine.  Make sure you don't have a permission problem associated with the named BOM.

           

          Jim S.

            • Re: API: Method "Getvar" of a IEdmBomCell object of a derived BOM
              Giuseppe Ceccherini

              Hi Jim, thanks for the reply.

               

              Jim Sculley ha scritto:

               

              There doesn't seem to be anything wrong with the code.  It works on my machine.  Make sure you don't have a permission problem associated with the named BOM.

               

              Jim S.

               

              does it mean that you have on both "_poValueObj" and "_conf" variables you have the correct values (column row value and configuration) and not an empty string?

              there's not problems of permissions.

              did you use the same version to test this code? (2011 sp5)

               

              at the moment I solved reading the desired values directly from EPDM database. it can possible doing a sql inner join on tables "BomSheetRow" and "BomSheetValue" knowing the ID of the BOM, version of the BOM, the row number and the column number.

              Maybe is not so "regular" but it works fine...

               

              Giuseppe

                • Re: API: Method "Getvar" of a IEdmBomCell object of a derived BOM
                  Jim Sculley

                  Giuseppe Ceccherini wrote:

                   

                  Hi Jim, thanks for the reply.

                   

                  Jim Sculley ha scritto:

                   

                  There doesn't seem to be anything wrong with the code.  It works on my machine.  Make sure you don't have a permission problem associated with the named BOM.

                   

                  Jim S.

                   

                  does it mean that you have on both "_poValueObj" and "_conf" variables you have the correct values (column row value and configuration) and not an empty string?

                  there's not problems of permissions.

                  did you use the same version to test this code? (2011 sp5)

                   

                  at the moment I solved reading the desired values directly from EPDM database. it can possible doing a sql inner join on tables "BomSheetRow" and "BomSheetValue" knowing the ID of the BOM, version of the BOM, the row number and the column number.

                  Maybe is not so "regular" but it works fine...

                   

                  Giuseppe

                  Your original question didn't say exactly which value was returning an empty string.  My original test looked at the _poValueObj and it was retruning the expected values.  Some further testing shows that the _conf value is returning an empty string.  The documentatino for GetVar isn't all that clear on what exactly is supposed to be returned.  A search of the Knowledge Base did turn up S-057402, which was supposedly fixed in Enterprise PDM 2012 SP1.  My testign was done with 2012 SP2, so this may not be the same issue.  The S-057402 article refers to S-056139 and S-048411, which contain some example code.  If you haven't seen these examples, you might want to look at them and try running them to see if the problem occurs there as well.

                   

                  Jim S.