Body
Overview
The Origin State field is calculated as follows. "Return" means that is the value that will be returned by the function and stored in the column. "Exit" means to skip the rest of the steps.
1. Find the description of the Nation code in SOASUPL (SABSUPL) row chosen first by the SOASUPL row associated with the currently effective SGASTDN (SGBSTDN) row, then, if not present, use the first SOASUPL row chronically. If there is a SOASUPL row and a nation value, return it and exit, otherwise go to step 2. (Note: by convention, if the student's nation is US, it will be stored as empty).
2. Examine the student's citizenship (CITZ) code in SPAPERS (SPBPERS). If it is "Student Visa-Has or Needs Visa" (5) or "Foreign National-No Visa Req'd" (7), then proceed with step 2a, else go to step 3.
2a. Find the first "Initial Admission" (IA) address chronoligically by From Date. If an IA address exists and the nation code is not blank, return its description and exit. Else go to step 2b
2b. If no IA address exists, then find the first "Mailing" (MA) address chronoligically by From Date. If the MA address exists and the nation code is not blank, return its description and exit. Else go to step 2c.
2c. If there is a state code in the SOASUPL row selected in step 1, return that code, else return "!". Exit.
3. If there is a SOASUPL record from step 1 and the state code in it is not empty, then return it and exit. Else go to step 4.
4. Find the first "Initial Admission" (IA) address chronologically. If an IA address exists and the state code is not empty, return it. Else return "!". Exit.
This logic is in the Banner function FZ_ORIGIN_STATE.