GetParentChildRecords

AB - Server - Called From Parent/Child

Major Business Rule

Object Name: B0100028

Parent DLL: CFIN

Location: Client/Server

Language: C



Functional Description


Purpose

This business function works in conjunction with B0100008.
This Program will retrieve information from a specified Parent/Child structure within the 

Address Book file (F0101).  The records can be retrieved in either Parent/Child or Child/Parent order 

depending on a sent parameter.  As the last record in the sequence has been processed an output 

parameter of "Last Record" will be set to a one. 



Setup Notes and Prerequisites


It is VERY important to call this routine on every exit point of execution.  For Everest 
applications this would be on either the close, cancel, OK, and select button that is on the form 

which first called this server.  The same would follow in UBE when getting ready to terminate the 

process.


See source node for parameter and other special details.


Special Logic

It is VERY important to call this routine as many times as it takes until the "LastRecord" flag 
has been set to a "1".

The input parameters are as follows:

*    Addressnumber - The calling program is responsible for sending the address number of the 

current level in this field.  This program will return the Parent/Child Address Number.

*    Organizationtypestructur - The calling program is responsible for sending the structure 

type of the address being inquired on in this field.

*    Modeprocessing - The valid values for this field are ' ', '1', '2', and '3'.  ' ' is the 

default and will direct this program to return the information in  Parent/Child order.  A '1' 

will return the information in Child/Parent order. '2' will take the address number entered and 

display the entire tree structure(s) that the address number entered is included in (Future 

Enhancement).  A '3' would allow the calling program         to terminate the parent/child server 

without having to call the server as many times as it takes to reach the last record (a stop 

processing flag) (Future Enhancement).

*    MaxLevel - This parameter will be used to determine how many levels are to be retrieved.  

Valid values are 1 through 25.

*    Duplicates - This parameter determines whether duplicate address numbers will be allowed 

to be output.  ' ' will allow duplicate address number to be output, '1' will suppress duplicate 

address numbers

*    WorkField - This REQUIRED parameter is used for internal use to this parent/child function 

only.  It is important that any program that uses this server must create a Math Numeric Work 

Field (recommended Data item is 'GENLNG') and store this field on the form if calling this 

routine from ER.   This work field should be initialized to zero before calling this function and 

should be returned back on eace recurring call.

*    Effective Date - This parameter is used to determine if records will be processed based on 

the effective date sent in.  If NO value is sent then ALL records will be read regardless of 

the effective date on the records.  This is different than how it worked on the AS400 parent/child 

server where a blank effective date, caused the parent/child server to default in and use the   

      current date.  This was changed so that the maintenance programs have a way of viewing 

all of the records.  Therefore it is important to note that it is the responsibility of the 

calling program (UBE, FDA, and/or business function) to send in the current date in this field.

 *  The output parameters are as follows:

*    Addressnumber - The calling program is responsible for sending the address number of the 
current level in this field.  This program will return the Parent/Child Address Number.

*    OutputLevel - This parameter will represent the current level of the Address book record 

being returned.  The calling program may use this parameter for totaling and display purposes.

*    LastRecord - As the last record in the sequence has been processed an output parameter of 

"Last Record" will be set to a one.

*    Datafielderrorcode - This parameter will be filled with the value of '1' if an unexpected 

has been encountered

  * ------------------------------------------------------------------*


* The architecture (or program flow) of the parent/child server is as follows:
 

 ==> First Call to B0100008 (ParentChildServer)  ==>   

 Running on Client or on Server Call to B0100028.C (GetParentChildRecords) Running on 
Server

*  This is designed this way to maximize speed by keeping I/O to be native to the server. Once 

running on the server the idea is to build the entire parent/child structure at one time and 

then send all information back to the client as one large string.

* The maximum number of records that can be sent is defined in the header file B0100028.H which 

is determined by the capacity of the network and the potential size of the string being 

created.

* Processing of the records is done by reading all of the records for the given level before 

proceeding to the next level.  This is done to save on the number of times that the file pointer 

would need to be repositioned and to take advantage of caching records selected with one SQL 

statement.

* Once all of the records have been read or until the maximum number of records to processed 

for a given call has been reached then this function saves off all of the processed records as one 

string to be passed back to B0100008.C Process returns to B0100008 <===  (ParentChildServer)

* Function then parses string for first child to send back to caller <=== to caller  ===>     

(ParentChildServer)

* Second call and so on.... Call to B0100008 to process the next record in the saved string to 

return back. <=== to caller           

 ===>     (ParentChildServer)

* This process continues until either there are no more children records to read or until the 
maximum number of records to process is reached.  If the entire tree has been processed then a 

'1' is returned in the cLastRecord flag. If the maximum number is reached and has been processed 

to the caller then the process         continues to get another string of address book numbers by 

calling B0100028.C


Technical Specifications


Parameters



Related Tables


Related Business Functions



Processing




Data Structure

D0100028 - A/B Server - Called from Parent/Child Server

Parameter NameData ItemData TypeReq/OptI/O/Both
mnAddressnumberAN8MATH_NUMERICNONENONE

A number that identifies an entry in the Address Book system, such as employee, applicant, participant, customer, supplier, tenant, or 
location.

szOrganizationtypestructurOSTPcharNONENONE

A user defined code (01/TS) that identifies a type of organizational structure that has its own hierarchy in the Address Book system (for 
example, e-mail). When you create a parent/child relationship for the Accounts Receivable system, the structure type must be blank.

cModeprocessingMODEcharNONENONE

The processing mode used in Purchase Order Consolidator to signify when specific orders are being processed.

mnLevelsRetrievedLVLMATH_NUMERICNONENONE

Level of Detail in the Description of a section.   Level 1 indicates the quarter quarter array consists of approximately 40 acres or 1/16th of a 
section.  If the recording level is a 2 the quarter quarter array is 1/16th of 1/16th of a section or 2.5 acres.

cAllowDuplicatesEV01charNONENONE

An option that specifies the type of processing for an event.

idWorkFieldGENLNGIDNONENONE

General purpose ID variable.

jdDateeffectiveEFTBJDEDATENONENONE

The date that an address, item, transaction, or table record becomes active.  The meaning of this field differs, depending on the program.  
For example, the effective date could represent the following:    o When a change of address becomes effective.   o When a lease becomes 
effective.   o When a price becomes effective.   o When the currency exchange rate becomes effective.   o When a tax rate becomes effective. 

Related Functions

None

Related Tables

F0150 Address Organization Structure Master