%%ItemTitle%%

VLF .NET Snap-in Components

VLF .NET Snap-in Components - Developer's Guide
Sample Code for Relationship Handler which Adds New Entries to the Instance List
Send comments on this topic.

Glossary Item Box

This relationship handler will retrieve sections associated with a department when the ‘Sections’ node (under department) is expanded in the HR Demonstration application:

Relationship Handler C# Copy Code
privatevoid OrgSecEmpRelationshipHandler_avExecute(object sender, RelationshipExecuteEventArgs args)
{
   stringparent = args.avParent.avBusinessObjectType;
   stringchild = args.avChildBusinessObjectType;
          
   if(parent == "DEM_ORG" && child == "DEM_ORG_SEC")
   {
       string dept = args.avParent.avAKey1;
       LOpen.Table sectionTable = VLFApplication.GetSession(this.avManager).Table("SECTAB");
       LOpen.Field departmentField = sectionTable.StringField("DEPTMENT");
       LOpen.Field sectionField = sectionTable.StringField("SECTION");
       LOpen.Field sectionDescField = sectionTable.StringField("SECDESC");
 
       departmentField.Value = dept;
 
       DataTable dt = sectionTable.Select(
               new LOpen.Field[] { sectionField, sectionDescField }, 
               new LOpen.Field[] { departmentField }, 
               false, null, false, false, false, false);
 
       foreach (DataRow dr in dt.Rows)
       {
          VLF.ListEntry entry = args.avListManager.avNewInstance();
          entry.avBusinessObjectType = "DEM_ORG_SEC";
          entry.avAKey1 = dept;
          entry.avAKey2 = dr["SECTION"].ToString();
          entry.avVisualID1 = dr["SECTION"].ToString();
          entry.avVisualID2 = dr["SECDESC"].ToString();
       }
   }
}

 

 

© LANSA