Print this Page
How Does It Work
Web Options
Close this Page

4.5.02 Web Options
Some drop down list fields are supported by a database view while the majority are supported by web option (WOP) data.   The WOP table contains set of options where each option is a code and description pair.
In addition, WOP options may have a colour theme and be limited in usage between a start and end date.   WOP options can be ordered by a sequence number to match business preferences.   WOS is the same as WOP except that the set options are unique to each site.   OPT is an obsolete record code that means WOP.   UOP is an user application set of options that are functionally the same as WOP, but may be changed by users.
Web Lookup (WLU) and Web Counter (WCT) are part of the same function library and closely related in functionallity.   WLU is a sql definition to create a code-description array from any pair of fields using any application table.   WCT is a sql definition to create a SUM or COUNT function on any application table - KPI use this capability.

Library
Include library "pdos_0240_reference_manager.c2" must hold all WOP functions.   This function library is included by application top for all transactions.

Evolution
Set names in c24 tend to exceed 8 characters.   Placeholder field c29 will take over using a 3 character record code and 2 digit field number as 5 characters fixed length.   This more formal c29 placeholder will enable this data to be optimised and its index to be smaller.

Life Cycle
Fields 30 and 32 old the option start and end dates.   When an add/clone form is shown, the data to be selected from a drop down list must be valid for todays date.   Options that have expired or are not yet ready to be used, sould not be in the drop down list to be selected.
But historical data is different, a record that was created last year will need the options to be shown that were valid last year.   While a change form must show all options ragardless of start-end date, the user is not permitted to select certain of those options.   A means to mark invalid options with say yellow on black and to prevent database update of an option value that is no longer valid must be discovered.
A quality validation popup report for all fields in a record may be an easier and more effective way to manage data quality.   Perhaps every (change) form needs a "quality" button to popup a validation page.   Perhaps a quality number should be deduced and included as a field in every record - c13 may be used.

Select Decode:
function pdos_5033_list_select_decode($set,$code)   Is used to decode a set and code into a description.   It may use WOP or OPT or WLU tables to get one desciption value.   The desciption value may be wrapped in a span colour theme.
SELECT $cols FROM wop1 WHERE c24=$set AND c23=$code AND c02=ACT LIMIT 1   This could benefit from an index on c24 and c23.
SELECT $cols FROM wlu1 WHERE c23=$set AND c02=ACT LIMIT 1   Has a prefix as LUP to use the WLU lookup record to create the sql needed to select from any application table.
SELECT $cols FROM wop1 WHERE c24=$set AND c23=$code AND c03=$site AND c02=ACT LIMIT 1   Has a prefix as WOS to append the session site key into the sql as c03.

Select Option:
function pdos_5033_select_code_desc_option($action,$setname,$code)   Is used to create an HTML string of options.   The option matching the code is marked as selected.   The HTML may include a colour theme on each option.   The action as LISTCOUNT can request a row count to be returned.

LUP Option:
Web Lookup (WLU) is a table that holds data that is used to construct an SQL statement that is used to create an HTML select drop down list.   WLU can specify any application table to be searched using any code-description pair of fields.   Typically a c01 and c45 will provide a key and company name drop down list.

Hardcoded Options:
Some code-descriptions are hard coded with a SET name as as:
SET-YESNO for the HTML used for Y (default) and N codes in a flag drop down list.
SET-NOYES for the HTML used for N (default) and Y codes in a flag drop down list.
SET-SECONDS for the HTML used for 0 to 59 seconds in a time drop down list.
SET-MINUTES for the HTML used for 0 to 59 minutes in a time drop down list.
SET-HOURS for the HTML used for 0 to 23 hours in a time drop down list.
SET-DAYS for the HTML used for 0 to 31 days in a date drop down list.
SET-MONTH for the HTML used for 0 to 12 months in a date drop down list.
SET-MONTHNAMES for the HTML used for 0 to 12 months in a date drop down list.
SET-YEARS for the HTML used for 10 years future and 89 years history in a date drop down list.
SET-YEAR-NEXT-LAST for the HTML used for 1 year future and 1 year history in a date drop down list.
SET-YEAR-THIS-10 for the HTML used for this year and 10 years history in a date drop down list.
SET-YEAR-NEXT-10 for the HTML used for this year and 10 years future in a date drop down list.
These set names must evolve to be 5 characters - WAA may be a common record code for hardcoded fields 01 to 99.

UOP Options:
User Option table UOP holds report field placeholders and related data that may be changed by users.   c14 is added to the seach criteria so UOP can be fragmented by c14 for different departments to have their own set of report data.   c14 is managed using SESSION_USR_APP that is assigned by 4GL meta statement.   By navigating to a specific web page, the UOP application session variable is set and will limit what UOP data can be viewed.

Future:
In every list page, decode selects are made on WOP to show descriptions for some fields in each row.   It may be a performance improvement to retain certain code-description pairs in an array while the list is being created so SQL selects can be minimised.
$wop_array[$set.$code]=$theme.$desc
Where the array key is the concatenation of the set and code so these can be directly used to select the description without a search.
Where the first character of the array value is a tcolour theme code and the rest of the value is the description.   Theme code "B" means black on white.   Theme code "R" means green on pink (please select...).   Theme code "W" means yellow on black (warning).