10 classes and 99 declared functions. Names beginning with an underscore are hidden. Inherited functions are documented on their declaring class.
cs.fnd.Fnd_Pref
Fnd_Pref
Created by: Wayne Stewart, Created: 2026-04-28
------------------
DataClass extension for [Fnd_Pref].
Provides a typed, thread-safe getter and setter for the preferences held in
the data file. Replaces the pointer-based v4_FndPrefGetSharedValue reader and
the classic-record v4_FndPrefSaveServerPreference writer.
The Owner column is the namespace. Three conventions live in it: the string
Fnd_Pref_SharedName for preferences everyone shares, a user name for the ones
that follow a user between machines, and any other label the caller chooses.
getNamed and setNamed take the owner; getShared and setShared are those two
with Fnd_Pref_SharedName filled in.
Numeric type matching: Is longint and Is real are treated as a single
numeric bucket so that an integer-stored value and a real default (or vice
versa) do not silently fall back to default. The classic reader
Fnd_Pref_GetSharedValue matches the two types exactly, so it is stricter than
this is; that difference is deliberate and stays.
Class extends DataClass
getShared · setShared · getNamed · setNamed · removeNamed · namesFor · owners
getShared
exposed Function getShared($name : Text; $default : Variant) : VariantNo function description is available in the source.
setShared
exposed Function setShared($name : Text; $value : Variant)No function description is available in the source.
getNamed
exposed Function getNamed($owner : Text; $name : Text; $default : Variant) : VariantNo function description is available in the source.
setNamed
exposed Function setNamed($owner : Text; $name : Text; $value : Variant)No function description is available in the source.
removeNamed
exposed Function removeNamed($owner : Text; $name : Text) : BooleanNo function description is available in the source.
namesFor
exposed Function namesFor($owner : Text) : CollectionNo function description is available in the source.
owners
exposed Function owners() : CollectionNo function description is available in the source.
cs.fnd.Fnd_PrefEntity
Fnd_PrefEntity
Created by: Wayne Stewart, Created: 2026-04-28
------------------
Entity extension for the [Fnd_Pref] dataclass.
Adds typed value access on top of the (Type, Value) column pair.
Value is stored as text; Type records the original 4D type so it can
be decoded on read. Supported types: Is text, Is longint, Is real,
Is boolean, Is object.
Class extends Entity
typedValue · setTypedValue
typedValue
Function typedValue() : VariantNo function description is available in the source.
setTypedValue
Function setTypedValue($value : Variant)No function description is available in the source.
cs.fnd.date
date
Created by: Wayne Stewart (Claude Opus 5) (2026-08-14)
------------------
The Fnd_Date module as a class, so a host can reach it through the class store
instead of the method names.
In a host: cs.fnd.date.new().toISO(Current date; Current time)
Inside Foundation: cs.date.new().toISO(Current date; Current time)
The namespace is the "Component namespace in the class store" setting, which is
"fnd" here. It governs how the host sees these classes; inside the component
they are plain cs.<name>.
Design decisions and assumptions:
- Every function delegates to the Fnd_Date_ method of the same behaviour. The
methods remain the implementation, so the class cannot drift from them and
adds no behavioural risk.
- Stateless, so new() is cheap and instances are interchangeable. What little
module state there is lives in Storage.Fnd.Date and Fnd.Date.
- Named for what they do rather than transcribing the method names, so
Fnd_Date_DateAndTimeToISO becomes toISO and Fnd_Date_ISOtoDate becomes
dateFromISO.
- Fnd_Date_Calendar and Fnd_Date_EntryFilter are not here. Both take a pointer
to a form object and only mean anything inside a running form, which is not
what a class store instance is for.
info · toISO · dateFromISO · timeFromISO · localTimestamp · fromParts · fromString · toString · endOfMonth · monthName · systemDateFormat · roundTime · roundTimeDown · roundTimeNear
info
Function info($infoRequested_t : Text)->$result_t : TextThe module's own labels — "name" and "version".
toISO
Function toISO($date_d : Date; $time_h : Time)->$result_t : TextA date alone gives YYYY-MM-DD, a date and time the joined form. A null
date with a time gives the time alone; a null date alone gives "".
dateFromISO
Function dateFromISO($isoDate_t : Text)->$result_d : DateReads YYYY-MM-DD and YYYY-MM-DDThh:mm:ss alike. 4D's own Date() will not
take the first of those, which is why this is not a wrapper over it.
timeFromISO
Function timeFromISO($isoDateTime_t : Text)->$result_h : TimeReads the time out of a stamp, including one carrying milliseconds or a
zone suffix. The suffix is dropped rather than applied, so no silent
conversion from UTC happens.
localTimestamp
Function localTimestamp()->$result_t : TextLocal wall-clock time, YYYY-MM-DDThh:mm:ss.mmm, with no zone suffix.
Comparable with other stamps from here, not with a UTC one.
fromParts
Function fromParts($year_i : Integer; $month_i : Integer; $day_i : Integer)->$result_d : DateOut of range parts roll over rather than being refused: month 13 is
January of the next year, day 0 the last day of the previous month.
fromString
Function fromString($theDate_t : Text; $dateFormat_t : Text)->$result_d : DateUnlike fromParts, this refuses a month above 12 or a day above 31, and
gives the null date instead. Pass a format such as "D/M/Y" to read the
string as something other than the machine's own setting.
toString
Function toString($theDate_t : Date; $relativeTo_d : Date; $dateFormat_t : Text)->$result_t : Text"Today", "Tomorrow" or "Yesterday" where they apply, localized; the null
date gives "". Everything else is formatted to the given format.
endOfMonth
Function endOfMonth($theDate_d : Date)->$result_d : DateThe last day of the month the date falls in.
monthName
Function monthName($monthNumber_i : Integer)->$result_t : TextLocalized. Anything outside 1 to 12 gives "Error".
systemDateFormat
Function systemDateFormat()->$result_t : Text"M/D/Y" or "D/M/Y" and so on, for the machine this is running on.
roundTime
Function roundTime($theTime_h : Time; $option_h : Time)->$result_h : TimeNo option, or 1, rounds to the nearest quarter hour; 2 rounds down.
roundTimeDown
Function roundTimeDown($theTime_h : Time)->$result_h : TimeDown to the quarter hour, however close the next one is.
roundTimeNear
Function roundTimeNear($theTime_h : Time)->$result_h : TimeThe quarter is held for ten minutes past it before the next is reached,
and the last five minutes of the day give 23:59 rather than midnight.
cs.fnd.fnd
Base Foundation Class - cs.fnd
info · getCurrentTable · setCurrentTable · getCurrentFormType · setComponentInfo · getComponentInfo · componentCheck
info
Function info($infoRequested_t : Text)->$result_t : TextThe component's own labels — "name" and "version". Anything else answers
"Component Did Not Recognize Request".
getCurrentTable
Function getCurrentTable->$result_ptr : PointerThe table this instance was told to work on, or Null if it was never set.
setCurrentTable
Function setCurrentTable($table_ptr : Pointer)->$result_ptr : PointerRecords the table to work on, and returns it.
getCurrentFormType
Function getCurrentFormType->$result_i : IntegerThe form type this instance was told to work on. Fnd_Gen_NoForm when none.
setComponentInfo
Function setComponentInfo($key_t : Text; $value_t : Text)->$result_t : TextPublishes one label for another component to read. The store lives on the
Form object, so this only works while a form is loaded.
getComponentInfo
Function getComponentInfo($key_t : Text)->$result_t : TextReads back a label another component published. Empty when there is none,
or when no form is loaded.
componentCheck
Function componentCheck($calling_t : Text; $required_t : Text)->$result_b : BooleanTrue when the required component answers. False alerts the developer first,
and does not stop the caller — test the result and decide.
cs.fnd.log
log
Created by WBS, 2026-09-12 (FND-26)
Logging access for hosts: cs.fnd.log.new(). No shared singleton syntax.
Delegates to methods; enabled/selection remain in the calling process.
A future 21 singleton can use the same functions without sharing process state.
enable · config · declareLog · useLog · label · overrideLevel · addEntry · flush · closeLog · createTable · shutdown · extension · fileName · path · maximumSize · info
enable
Function enable($enabled_b : Boolean)->$result_b : BooleanRead or set the current process enable flag.
config
Function config($options_o : Object)->$result_o : ObjectRead or update application defaults; declared logs keep their settings.
declareLog
Function declareLog($label_t : Text; $file_t : Text; $folder_t : Text; $options_o : Object; $dedicated_b : Boolean)Declare once; optional dedicated writer defaults to False.
useLog
Function useLog($label_t : Text)Empty/omitted selects default; does not alter enable state.
label
Function label()->$result_t : TextCurrent process log label.
overrideLevel
Function overrideLevel($level_i : Integer; $application_b : Boolean)->$result_i : IntegerNo arguments reads effective threshold. Optional True sets application scope.
addEntry
Function addEntry($message_v : Variant; $options_o : Object)Text or a collection of text columns, plus optional entry metadata.
flush
Function flush($label_t : Text)Queue a flush; no completion acknowledgement.
closeLog
Function closeLog($label_t : Text)Flush and close a label, or all logs when omitted.
createTable
Function createTable()->$result_o : ObjectExplicit only; interpreted host required. Inspect restartRequired.
shutdown
Function shutdown()Call after producers finish, outside a logger worker.
extension
Function extension($value_t : Text)->$result_t : TextOmit to read; pass text to update through Fnd_Log_Extension.
fileName
Function fileName($value_t : Text)->$result_t : TextOmit to read; pass text to update through Fnd_Log_FileName.
path
Function path($value_t : Text)->$result_t : TextOmit to read; pass text to update through Fnd_Log_Path.
maximumSize
Function maximumSize($bytes_i : Integer)->$result_i : IntegerGet/set rollover size; zero disables rollover.
info
Function info($request_t : Text)->$result_t : TextExisting module name/version/logging query API.
cs.fnd.pref
pref
Created by: Wayne Stewart (Claude Opus 5) (2026-08-14)
------------------
The Fnd_Pref module as a class, so a host can reach it through the class store
instead of the method names.
In a host: cs.fnd.pref.new().getText("Report: Last Folder"; "")
Inside Foundation: cs.pref.new().getText("Report: Last Folder"; "")
The namespace is the "Component namespace in the class store" setting, which is
"fnd" here. It governs how the host sees these classes; inside the component
they are plain cs.<name>.
Not to be confused with cs.Fnd_Pref, which is the DataClass extension for the
[Fnd_Pref] table and belongs to the host that owns the table. This one is the
module's API and belongs to the component.
Design decisions and assumptions:
- Every function delegates to the Fnd_Pref_ method of the same behaviour. The
methods remain the implementation, so the class cannot drift from them and
adds no behavioural risk.
- Stateless, so new() is cheap and instances are interchangeable. Module state
lives in Storage.Fnd.Pref, shared by both routes.
- getWindow is the one place the shape changes rather than passing through. The
method writes through four pointers, which is not something to publish on a
modern API, so this returns {left; top; right; bottom} - or Null when nothing
is stored, which the pointer form signals by leaving the caller's variables
alone.
- The scope argument is a constant or a label, the same Variant the methods
take. On a getter it only says where to store a default it has to create; on
remove it says where to delete from. See the method headers.
- 4D 20 LTS has no singletons, so a host instantiates: cs.fnd.pref.new(). From
21 a shared singleton would allow cs.fnd.pref.me, and the functions below
would not change.info · path · userName · save · getText · getBoolean · getLongInt · getReal · getObject · getWindow · setText · setBoolean · setLongInt · setReal · setObject · setWindow · remove
info
Function info($infoRequested_t : Text)->$result_t : TextThe module's own labels — "name" and "version".
path
Function path()->$result_t : TextWhere the local preferences file is, or would be.
userName
Function userName($name_t : Text)->$result_t : TextThe name the server preferences are owned by. Setting it reloads.
save
Function save()Writes the local file and the user's server preferences. Called on quit.
getText
Function getText($name_t : Text; $default_t : Text; $scope_v : Variant)->$result_t : TextThe stored text, or the default. Passing a default stores it when the
preference does not exist yet; the scope says where.
getBoolean
Function getBoolean($name_t : Text; $default_b : Boolean; $scope_v : Variant)->$result_b : BooleanAs getText, for a Boolean.
getLongInt
Function getLongInt($name_t : Text; $default_i : Integer; $scope_v : Variant)->$result_i : IntegerAs getText, for an Integer.
getReal
Function getReal($name_t : Text; $default_r : Real; $scope_v : Variant)->$result_r : RealAs getText, for a Real.
getObject
Function getObject($name_t : Text; $default_o : Object; $scope_v : Variant)->$result_o : ObjectAs getText, for an Object.
getWindow
Function getWindow($name_t : Text)->$result_o : ObjectNo function description is available in the source.
setText
Function setText($name_t : Text; $value_t : Text; $scope_v : Variant)Stores the value. The scope decides local or server; the default is the
module's, see the method header.
setBoolean
Function setBoolean($name_t : Text; $value_b : Boolean; $scope_v : Variant)As setText, for a Boolean.
setLongInt
Function setLongInt($name_t : Text; $value_i : Integer; $scope_v : Variant)As setText, for an Integer.
setReal
Function setReal($name_t : Text; $value_r : Real; $scope_v : Variant)As setText, for a Real.
setObject
Function setObject($name_t : Text; $value_o : Object; $scope_v : Variant)As setText, for an Object.
setWindow
Function setWindow($name_t : Text; $rect_o : Object)Pass {left; top; right; bottom}, or nothing for the frontmost window of
the current process.
remove
Function remove($name_t : Text; $scope_v : Variant)->$result_b : BooleanTrue if there was one to delete. The scope says where to delete from.
cs.fnd.pswd
pswd
Created by: Wayne Stewart (Claude Opus 5) (2026-08-14)
------------------
The Fnd_Pswd module as a class, so a host can reach it through the class store
instead of the method names.
In a host: cs.fnd.pswd.new().generate({length: 16})
Inside Foundation: cs.pswd.new().generate({length: 16})
The namespace is the "Component namespace in the class store" setting, which is
"fnd" here. It governs how the host sees these classes; inside the component
they are plain cs.<name>.
Design decisions and assumptions:
- Every function delegates to the Fnd_Pswd_ method of the same behaviour. The
methods remain the implementation, so the class cannot drift from them and
adds no behavioural risk.
- Stateless, so new() is cheap and instances are interchangeable. Module state
lives in Storage.Fnd.Pswd, shared by both routes.
- generate() taking an options object is the one to reach for: it touches no
shared state, so it is safe from a worker and from two processes at once.
The setters below change the stored defaults and are not.
- 4D 20 LTS has no singletons, so a host instantiates: cs.fnd.pswd.new(). From
21 a shared singleton would allow cs.fnd.pswd.me, and the functions below
would not change.info · generate · validCharacters · strength · dialog · useUppercase · useLowercase · useNumbers · useSymbols · customCharacters · excludeCharacters · minLength · maxLength
info
Function info($infoRequested_t : Text)->$result_t : TextThe module's own labels — "name" and "version".
generate
Function generate($options_o : Object)->$result_t : TextPass nothing for the stored settings, or an object to override them for
this call only: {type; length; minLength; maxLength; useUppercase;
useLowercase; useNumbers; useSymbols; customCharacters;
excludedCharacters; requireEachClass}
validCharacters
Function validCharacters($options_o : Object)->$result_t : TextThe alphabet a generation would draw from, under the same options.
strength
Function strength($password_t : Text; $options_o : Object)->$result_o : Object{ length ; poolSize ; bits ; rating }. Pass {type} when it is known, or a
pronounceable password is weighed on its characters and overstated.
dialog
Function dialog()->$result_t : TextShows the generator dialog. Returns "" if it was cancelled.
useUppercase
Function useUppercase($use_b : Boolean)->$result_b : BooleanReads the stored default, or sets it when passed a value.
useLowercase
Function useLowercase($use_b : Boolean)->$result_b : BooleanReads the stored default, or sets it when passed a value.
useNumbers
Function useNumbers($use_b : Boolean)->$result_b : BooleanReads the stored default, or sets it when passed a value.
useSymbols
Function useSymbols($use_b : Boolean)->$result_b : BooleanReads the stored default, or sets it when passed a value.
customCharacters
Function customCharacters($characters_t : Text)->$result_t : TextSetting characters turns the custom set on; setting none turns it off.
excludeCharacters
Function excludeCharacters($characters_t : Text)->$result_t : TextMatched exactly, so excluding "o" leaves "O" alone.
minLength
Function minLength($characters_i : Integer; $limit_i : Integer)->$result_i : IntegerCarries the maximum up with it rather than leaving the pair inverted.
maxLength
Function maxLength($characters_i : Integer; $limit_i : Integer)->$result_i : IntegerCarries the minimum down with it, the mirror of minLength.
cs.fnd.text
text
Created by: Wayne Stewart (Claude Opus 5) (2026-08-13)
WBS, 2026-09-12 - Expose existing whitespace trim through the class.
------------------
The Fnd_Text module as a class, so a host can reach it through the class store
instead of the method names.
In a host: cs.fnd.text.new().capitalize("hello world")
Inside Foundation: cs.text.new().capitalize("hello world")
The namespace is the "Component namespace in the class store" setting, which is
"fnd" here. It governs how the host sees these classes; inside the component
they are plain cs.<name>.
Design decisions and assumptions:
- Every function delegates to the Fnd_Text_ method of the same behaviour. The
methods remain the implementation, so the class cannot drift from them and
adds no behavioural risk. The direction can invert later, one function at a
time, without either API changing.
- Stateless, so new() is cheap and instances are interchangeable. Module state
lives in Storage.Fnd.Text, shared by both routes.
- 4D 20 LTS has no singletons, so a host instantiates: cs.fnd.text.new(). From
21 a shared singleton would allow cs.fnd.text.me, and the functions below
would not change.
- Named for what they do rather than transcribing the method names, so
Fnd_Text_TextToMD5 becomes toMD5 and Fnd_Text_Base64ToText becomes fromBase64.info · capitalize · capitalizeExclude · padSpaces · stripSpaces · trim · wrap · equalStrings · formatNumber · toMD5 · md5Encoding · toBase64 · fromBase64 · encodeBase64 · decodeBase64
info
Function info($infoRequested_t : Text)->$result_t : TextThe module's own labels — "name" and "version".
capitalize
Function capitalize($theText_t : Text; $options_i : Integer)->$result_t : TextBook title capitalisation. Option 4 skips the exclude word list.
capitalizeExclude
Function capitalizeExclude($words_c : Collection)->$result_c : CollectionPass a collection to replace the exclude word list, or nothing to read it.
padSpaces
Function padSpaces($theText_t : Text; $length_i : Integer)->$result_t : TextPads with spaces, or truncates, to exactly $length_i characters.
stripSpaces
Function stripSpaces($theText_t : Text; $options_i : Integer; $altSpaces_t : Text)->$result_t : Text1 leading, 2 trailing, 4 doubles, added together. Default is 1+2.
trim
Function trim($theText_t : Text)->$result_t : TextTrim both ends using Fnd_Text_Trim's whitespace set; preserve NBSP.
wrap
Function wrap($theText_t : Text; $lineLength_i : Integer)->$result_t : TextWraps at the last space before the limit, joined by carriage returns.
equalStrings
Function equalStrings($stringOne_t : Text; $stringTwo_t : Text)->$result_b : BooleanCase and diacritic sensitive, unlike 4D's = operator.
formatNumber
Function formatNumber($theNumber_t : Text; $theFormat_t : Text)->$result_t : TextStrips punctuation from the number, then applies the 4D number format.
toMD5
Function toMD5($theText_t : Text; $charset_t : Text)->$result_t : TextDefaults to ISO-8859-1, which is what Foundation has always hashed.
md5Encoding
Function md5Encoding($charset_t : Text)->$result_t : TextSets the charset every later toMD5 uses, or reads it when passed nothing.
toBase64
Function toBase64($theText_t : Text)->$result_t : TextBase64 on one line: BASE64 ENCODE does not wrap at 76 characters.
fromBase64
Function fromBase64($theText_t : Text)->$result_t : TextThe reverse of toBase64.
encodeBase64
Function encodeBase64($theBlob_x : Blob)->$result_x : BlobTakes and returns a blob, rather than the pointer the method wants.
decodeBase64
Function decodeBase64($theBlob_x : Blob)->$result_x : BlobTakes and returns a blob, rather than the pointer the method wants.
cs.fnd.wnd
Class extends fnd // cs.fnd.wnd
title · type · position · closeBox · openWindow · openFormWindow · useSavedPosition · closeNow
title
Function title($title_t : Text) : TextNo function description is available in the source.
type
Function type($type_i : Integer)->$result_i : IntegerNo function description is available in the source.
position
Function position($position_i : Integer)->$result_i : IntegerNo function description is available in the source.
closeBox
Function closeBox($enabled_b : Boolean)->$result_b : BooleanNo function description is available in the source.
openWindow
Function openWindow($width_i : Integer; $height_i : Integer)->$result_i : IntegerNo function description is available in the source.
openFormWindow
Function openFormWindow($table_ptr : Pointer; $formName_t : Text)->$result_i : IntegerNo function description is available in the source.
useSavedPosition
Function useSavedPosition($name_t : Text)->$result_b : BooleanNo function description is available in the source.
closeNow
Function closeNow->$result_b : Boolean$result_b:=Process_IsClosing