Example: Using the Tree Node is Expanded Event
In this example, ER is attached to an application on the Tree Node Is Expanding event:
Suppress Fetch on Node Expand(FC parent/child) // // Here are the variables to get out of the account and the business unit loop // being initialized. VA frm_OutOfLoop = "0" VA frm_ExistAcctLoop = "0" // // If Loop looking at the GC Business Unit Field. If GC BusinessUnit is equal to <Blank> // // Select the F0006 differently if there is one company or all companies // F0006.Open If VA frm_AllCompanies is equal to "1" VA frm_CurCompany = GC Co F0006.Select Else VA frm_CurCompany = BC Company F0006.Select End If // // While Loop which fetches the business units for a specific company. // If the company changes we get out of the loop. While VA frm_OutOfLoop is equal to <Zero> // Fetch the records from the F0006 Table. F0006.FetchNext GB BusinessUnit = GB Companies If SV File_IO_Status is equal to CO SUCCESS GB Co = BC Company VA frm_PreCompany = BC Company VA frm_ConcateBuDesc = " " VA frm_ConcateBuDesc = concat([VA frm_ConcateBuDesc],[VA frm_NameOfBU]) GB CompanyStructure = concat([GB Companies],[VA frm_ConcateBuDesc]) GB Companies = concat([GB Companies],[VA frm_ConcateBuDesc]) // // Tells the Level of the Tree Structure. GB LevelOfTreeInt = "1" // Insert Grid Buffer Row(FC parent/child, <After Last Row>, <Yes>, <No>, <No>, <No>, <No>, <Yes>) Set Tree Node Bitmap(FC parent/child, <Last Grid Row>, BussUnit.bmp, <Yes>) // // If VA frm_PreCompany is not equal to VA frm_CurCompany VA frm_OutOfLoop = "1" End If Else VA frm_OutOfLoop = "1" End If End While F0006.Close Else // Loop thru the F0901 to get the corresponding accounts. // VA frm_CURBU = GC BusinessUnit F0901.Open F0901.Select If SV File_IO_Status is equal to CO ERROR // End If // // While Loop to pick up the accounts till the Fetch Fails. While VA frm_ExistAcctLoop is equal to <Zero> F0901.FetchNext GB Sub = VA frm_DBSUB GB ObjAcct = VA frm_DBOBJ GB Name = VA frm_AcctDesc GB BusinessUnit = VA frm_CURBU VA frm_AcctDesc = concat([VA frm_BLANKS],[VA frm_AcctDesc]) GB AccountID = VA frm_AIDF0901 GC AccountID = VA frm_AIDF0901 If SV File_IO_Status is equal to CO ERROR VA frm_ExistAcctLoop = "1" Else GC Companies = " " GB Companies = " " Business Unit, Object, Subsidiary Merge GB Companies = concat([VA frm_DBANI],[VA frm_AcctDesc]) GB CompanyStructure = concat([VA frm_DBANI],[VA frm_AcctDesc]) GC Companies = VA frm_AIDF0901 // // Tells the level of the Tree Structure '2' GB LevelOfTreeInt = "2" // Insert Grid Buffer Row(FC parent/child, <After Last Row>, <Yes>, <No>, <No>, <No>, <No>, <No>) Set Tree Node Bitmap(FC parent/child, <Last Grid Row>, accounts.bmp, <Yes>) End If End While End If FC BUFrom = " "