%%ItemTitle%%

VLF .NET Snap-in Components

VLF .NET Snap-in Components - Developer's Guide
Sample code for a filter which adds new entries to the instance list
Send comments on this topic.

Glossary Item Box

This sample code uses L/Open for .NET to retrieve data for the instance list:

Filter Source C# Copy Code
// Change application status to busy
VLFApplication.SetBusy(this.avManager, true);
 
// Always call avBeginListUpdate before making changes to the instance list
this.avListManager.avBeginListUpdate();
try
{
   // Use LOpen.NET to retrieve the list of departments
   LOpen.Table deptTable = VLFApplication.GetSession(this.avManager).Table("DEPTAB");
   LOpen.StringField codeField = deptTable.StringField("DEPTMENT");
   LOpen.StringField descField = deptTable.StringField("DEPTDESC");
   DataTable dataTable = deptTable.Select(
                      new LOpen.Field[] { codeField, descField }, 
                      new LOpen.Field[] { }, 
                      false, null, false, false, false, false);
 
   // Always clear the instance list in a filter otherwise the entries will be duplicated
   this.avListManager.avClearList();
 
   // Populate with newly retrieved records
   int i = 0;
   foreach (DataRow row in dataTable.Rows)
   {
       VLF.ListEntry entry = this.avListManager.avNewInstance();
       entry.avBusinessObjectType = "DEM_ORG";
       entry.avAColumnCount = 10;
       entry.avNColumnCount = 10;
       entry.avAKey1 = row["DEPTMENT"].ToString();
       entry.avVisualID1 = row["DEPTDESC"].ToString();
       entry.avVisualID2 = row["DEPTMENT"].ToString();
       i++;
       if (i >= maxCount) break;
   }
}
finally
{
   // Always call avEndListUpdate at the end of instance list update
   this.avListManager.avEndListUpdate();
   VLFApplication.SetBusy(this.avManager, false);
}

 

© LANSA