Skip to content

Latest commit

 

History

History
34 lines (32 loc) · 7.7 KB

RuleOptions.md

File metadata and controls

34 lines (32 loc) · 7.7 KB

Field rules

  • All rule names are case insensitive.
  • "to JSON" column says that you can/cannot use this rule in json::CreateObject(group), json::CreateArray(queue/file).
  • "from JSON" column says that you can/cannot use this rule in ToGroup, ToQueue, ToFile methods.
  • Default values: for strings - empty string, for numbers - 0, for booleans - false. Assigning a default value to a rule overrides the previously assigned value.
  • "Name" is required rule and cannot be blank.
Rule name Type Possible values to JSON from JSON Description
ArraySize number array size Yes Yes Max allowed array size; also DIM(1) issue fix. Negative value means that the json array will be read from the end in reverse order.
Auto bool true, false No Yes Field value must be assigned in AutoCB callback method, most rules are not used.
Deformat string picture token Yes Yes Call fld = DEFORMAT(value, picture).
EmptyString string "null", "ignore" Yes No "null": create null object; "ignore": do not create empty string object.
FieldNumber number field ordinal position in a group/queue Yes Yes An ordinal position of a field in a queue; if FieldNumber > 0 then json array will be built from this field only and look like ["alpha", "beta"] or [1,2,3].
Format string picture token Yes Yes Call fld = FORMAT(value, picture).
FormatLeft string picture token Yes Yes Call fld = LEFT(FORMAT(value, picture)). FORMAT pads spaces on the left for numeric pictures.
Ignore bool true, false Yes Yes Do not process the field.
IgnoreEmptyArray bool true, false Yes No Do not create empty array [].
IgnoreEmptyObject bool true, false Yes No Do not create empty object {}.
IgnoreFalse bool true, false Yes No Do not create bool object with 'false' value.
IgnoreTrue bool true, false Yes No Do not create bool object with 'true' value.
IgnoreZero bool true, false Yes No Do not create numeric object with 0 value.
Instance number INSTANCE(queue, thread) Yes Yes A reference to a queue.
IsBase64 bool true, false Yes Yes Field is base64 encoded json string.
IsBool bool true, false Yes No Field is BOOLEAN.
IsFile bool true, false Yes No Field is a filename, result is a file content. Use "IsBase64":true to store the content as base64.
IsQueue bool true, false Yes No Field is a queue: create a json array. Next field must have a value of INSTANCE(queue).
IsStringRef bool true, false Yes Yes Field is &STRING, assigned to static string or another variable.
IsRaw bool true, false Yes No Field is raw json string.
JsonName string json name or "*" Yes Yes Json item name. Use this rule when Clarion name of the field does not match a name in json. An asterisk ("*") says to use name's value instead.
Name string, array field name, names array, or "*" Yes Yes Field name w/o prefix, an array of field names, or '*' for any field. Named options take precedence over those specified in an array.
RequiredChild string json name Yes No Don't create json objects whose child item is null or empty.
RuleHelper number ADDRESS of TCJsonRuleHelper instance Yes Yes Callback methods allow you to fine-tune the way data is processed.