5 Replies Latest reply on Oct 11, 2016 7:30 PM by dmauldin@dbmsoft.com

    AF Wrapper Problem and Question - Run-time Error '8325' An Argument was expected but not supplied.  Ideas?

    dmauldin@dbmsoft.com

      I have been trying to implement the base version of the AF Wrapper.  I have built the dll using Visual Studio 2013 after changing the .Net version to 3.5.   I registered the dll, first with the Visual Studio build and then also using REGASM, which gave the success message for the two targets.

       

      I tried both the supplied ProcessBook and one based on the Transformer Example Kit.   The first AF Wrapper call is triggered by a context change.    On a context change, the error message is received.

       

      I have looked at the code, but have not been able to see where an argument  that should be provided is not being provided.

       

       

      Any ideas will be greatly appreciated.

       

      Thanks.

       

      Don Mauldin

        • Re: AF Wrapper Problem and Question - Run-time Error '8325' An Argument was expected but not supplied.  Ideas?
          jyi

          Hello Don,

           

          From my understanding, you are referencing below method:

          PIPointClass.GetAttributeValue Method

           

          By looking at the method, I see two things. GetAttributeValue method needs to come from PI Point Class. Please see example from above link.

          object drAttrValue;
          drAttrValue = myAttribute.PIPoint.GetAttribute(item);
          

           

          Also PIPointClass.GetAttributeValue will get PI Point's attribute value meaning its attribute like (Location1, Pointsource, ExeMax...etc)

          If you wanted to get the AF Attribute's value, then you need to use something similar to below:

          AFAttribute.GetValue Method

           

          I hope I am on the right track.

          Jin

            • Re: AF Wrapper Problem and Question - Run-time Error '8325' An Argument was expected but not supplied.  Ideas?
              dmauldin@dbmsoft.com

              Thanks for the response, Jin.   I only posted part of the code.   The AF Wrapper code defines the AFW.GetCurrent Value function.  I am really trying to get to the AF Structure from VBA.

               

              I have dug deeper into the problem.  It looks like there is a problem in handling Null returns or attributes.  I have been using the wrapper function GetElementDescription and have been making changes or adding Returns to pin down the exact statement that triggered the error.

               

              The code snippet from ProcessBook VBA that is failing is

               

              Private Sub oContextHandler_ContextChanged(FromDisplay As Display, FromContexthandler As ContextHandler)

               

              DoEvents

               

              txtContext.Contents = oContextHandler.Name

               

                 elemdesc.Contents = AFW.Getelementdescription(oContextHandler.CurrentContext(ThisDisplay))            '   This is the line that fails (sometimes)

               

              End Sub

               

              The code snippet from the Wrapper that I have gotten to  is:

              // Gets an element description for a given element path

                      [ComVisible(true)]

                      public string GetElementDescription(string fullElementPath)

                      {

                    

                          AFElement element = GetElement(fullElementPath);

                          if (element.Description != null ) return element.Description;

                          else return "No Description New   ";

               

                          if (element != null && element.Description != null) return element.Description;

                          else return "No Description    ";

                      }

               

               

              The GetElement function seems to work, returning an element.   The first IF statement I added.   The second was in the original wrapper.

               

              Further investigation revealed that referencing element.Description in any statement fails if the element description in AF is blank. But, if the element has a description, it works.

               

              I confirmed this by changing the context to an element with a description and seeing success.    I change the context to an element with no description and received an error.   Then, I added a description to the failing element and repeated the test.   This time, choosing the element where I added a description worked correctly.

               

              I am not sure what is causing the failure that occurs when an element attribute that is null is referenced.

               

              Ideas?

               

              Thanks

               

              don