3 Replies Latest reply on Apr 24, 2018 8:07 AM by igreguri

    How in Excel get value from AF table  lookup where parameter is value form Excel cell?

    jag_69

      I create table in AF. I filled it with data. The table has two columns.

      Now, in MS Excel (PI DataLink) I would like to get value from AF (table lookup) if I put in to cell value, expl. 7-KTX as parameter I want to get a factor value 0,575.

       

      How to do it? Any sugestion?

        • Re: How in Excel get value from AF table  lookup where parameter is value form Excel cell?
          igreguri

          Maybe something like this... (just an idea)

          Create in AF attributes:

          • first value from Excel,
          • and another for table lookup value.

          Enter value through VBA to first AF attribute (some button, on click).

          Read table lookup value from second AF attribute. 

           

          Regards,

          Igor

            • Re: How in Excel get value from AF table  lookup where parameter is value form Excel cell?
              jag_69

              May be it's a good way.

              I create two attributes:

              The data like 1-EKTX get from another system (through query in VBA).

              Do you have any VBA example how to write to AF attribute?

               

              Thx for your help.

                • Re: How in Excel get value from AF table  lookup where parameter is value form Excel cell?
                  igreguri

                  This is example to input value into PI point (tested working)...

                  You can call PI point to AF attribute (I don't have example to input value in AF attribute, but it should not be a problem).

                   

                  Sub ImportToPI_TEST()

                   

                     'The following four variables are arguments to PIPutVal()

                     Dim sTagname As String  'Tagname

                     Dim stime As Range   'Timestamp

                     Dim valueCell As Range 'Cell reference containing value to be written

                     Dim resultCell As Range 'Cell reference to hold result

                     Dim sServer3 As String   'PI3 server name

                     Dim macroResult As Variant

                   

                     'Range("A101").Value = Now()

                        

                     'sTagname = "PI_POINT.PV"

                     sTagname = "PI_TEST.MDE"

                     Set stime = Worksheets("Test").Cells(101, 1)

                     Set valueCell = Worksheets("Test").Cells(33, 1)

                     sServer3 = "PISystem"

                   

                     Set resultCell = Worksheets("TEST").Cells(48, 4)

                     macroResult = Application.Run("PIPutVal", sTagname, valueCell, stime, sServer3, resultCell)

                    

                     Range("A100", "A101").ClearContents

                     Range("A47").Select

                   

                  End Sub

                  1 of 1 people found this helpful