AnsweredAssumed Answered

How To Loop Through The Values of AF Table Using AFSDK

Question asked by James Devine on Dec 2, 2014
Latest reply on Dec 2, 2014 by kwinnike
Greetings to my fellow PI Geeks:
 
I need some help looping through an AF Table. I am not finding answers doing a variety of searches on this topic. In C# I am able to connect to the default AF database and identify the target table. Unfortunately I cannot seem to find out how to parse through it and perform operations using the retrieved values. Here is my function:
 
        public HtmlString parseAndPrintAFTable()
        {
            HtmlString theEnvelopePlease = null;
            string content = "";

            //# Connect to the default AF server:
            PISystems piSystems = new PISystems();
            PISystem thisPISystem = piSystems.DefaultPISystem;

            //# Find and select an AF Database:
            AFDatabase targetAFDatabase = thisPISystem.Databases.DefaultDatabase;

            //# Find and select an AF Table:
            AFTables thoseTables = targetAFDatabase.Tables;
            foreach (AFTable thisTable in thoseTables)
            {
                if(thisTable.Name == "theTargetTable")
                {
                    //# Here is where I need help:
                    foreach (value in theTargetTable)
                    {
                         //# perform operations on the retrieved values:
                    }
                }
            }

            //# Return the data for display in an HTML format:
            theEnvelopePlease = new HtmlString(content);
            return theEnvelopePlease;

        }

Your help with this is appreciated.

 

Outcomes