Input fields from Web pages are returned over the Internet as a 'flattened' list of data, a string in the form of Name=Value&Name=Value etc.
Freedombase builds instances, including multi values on multi dimensional systems, from this string, and then passes the built instance to the Process.
Under many circumstances, some attributes will not be returned from the browser - usually when they were not output to the browser in the first place.
In this circumstance, when saving data onto file, Freedombase will retrieve the missing attribute values from file, and will merge them into the instance in memory, before updating that merged instance back to file.
However, Freedombase also needs to know when an attribute was returned from the browser with a blank value.
In order for the Process to distinguish between an attribute that was not returned at all, and therefore should be loaded from file, and an attribute that was returned as a blank, and therefore should be left blank, Freedombase uses a string of characters set aside specifically for this purpose. This string of characters is included in the Freedombase_Definition include file.
When the Process Before Code is called, attributes not passed back from the browser have not yet been loaded from file.
It is necessary to distinguish between attributes not passed back from the browser, and attributes passed back as blank, within the Process Before.
In order to distinguish between the two, the Freedombase_Definition include must be included in the Process Before Code.
Attributes that were not passed back will have a null or empty value, and attributes that were passed back as blank will have a value equal to Freedombase_BlankAttribute_String. Comparing the values of attributes against Freedombase_BlankAttribute_String can be used to determine which attributes will be left blank when saved, and which will be populated from data currently on file.
An example is:
SUBROUTINE MAILBOX_JOB_Before(Command,RawData,Instance,Instance_Key,ErrorMessage,Occurrence,DatabaseeClassList,KeyList,InstanceList,ErrorMessageList,SequenceList,NoUpdateFlagList,CurrentSelect,CascadeRecurse,Cascade_Cascade_KeyList,Cascade_CascadeToKeyList,PreviousDatabaseeClassList,PreviousKeyList,PreviousDateTimeWrittenList,PreviousNoUpdateFlagList,User,MetaErrorFlag)
$INCLUDE FB_BP Freedombase_Definition
$INCLUDE Process_BP MAILBOX_JOB_Definition
IF Command = 'Save' AND Instance NE '' THEN
IF (Instance<MAILBOX_JOB_PAID>) AND Instance<MAILBOX_JOB_PAID> NE Freedombase_BlankAttribute_String THEN
StartDate = Instance<MAILBOX_JOB_PAID>
GOSUB GetPeriod
Instance<MAILBOX_JOB_PERIOD> = Period
END
END
RETURN
GetPeriod:
IF NOT(StartDate) THEN
StartDate = DATE()
END
StartDate = OCONV(StartDate,'D4')
Period = FIELD(StartDate,' ',3)
LOCATE FIELD(StartDate,' ',2) IN 'JAN':@AM:'FEB':@AM:'MAR':@AM:'APR':@AM:'MAY':@AM:'JUN':@AM:'JUL':@AM:'AUG':@AM:'SEP':@AM:'OCT':@AM:'NOV':@AM:'DEC' SETTING Position THEN
Position = Position / 3
IF Position NE INT(Position) THEN
Position = INT(Position) + 1
END
Period := Position
END
RETURN
END
| previous | next |
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |

