The SFormat is a super BFormat. It provides additional features to navigate through components & relations, read tags, modify text (escape, substring, etc) and so on.

A SFormat is defined by a chain of characters between curly brackets { } and is a succession of functions used to build the result. Unlike the BFormat, the SFormat result can be a component or any object (while BFormat can only result in a String).

Example: {parent.relations('out','b:isIn').item(1).%displayName%}  -> Take the parent, then follow its outbound relations b:isIn, then take the second element (because there might be several relations) and then apply the BFormat to get the displayName.


Functions in a SFormat can take parameters between parenthesis and separated by a coma. It can take one of the following parameters depending on the function:

    • String: 'param'
    • Number: 3 or 6.4
    • Boolean: true or false


SFormat is used in Active components such as InfoSource, HistoryDisplayName management and is mainly used in Strategies.
Example: {parent.inRel('b:isIn')}

Classic BFormat can be defined between %...% (as usual). It can be introduced after the definition of a component by SFormat functions or directly at the root as a classic BFormat.
Example: {parent.inRel('b:isIn').%displayName%}

If you want to avoid interpretation of SFormat, you can use [...], so the format will not be resolved.
Example: station:|slot:|bql:select slotPathOrd, displayName, [btibCore:BqlLib.sFormat('{origin.inRel(b:strSourceOf).parent.%slotPathOrd%}')] from btibStructure:Node where b:floor = '{origin.%displayName%}' will result in: station:|slot:|bql:select slotPathOrd, displayName, btibCore:BqlLib.sFormat('{origin.inRel(b:strSourceOf).parent.%slotPathOrd%}') from btibStructure:Node where b:floor = 'Floor 1' 


Here is the list of the functions currently implemented by the SFormat.
Recently added functions are highlighted in blue.

NameDescriptionBase TypeParametersReturn Type
parentGet the parent of a component.Component

-

Component
children

Get the children of a component.

Component-Array
slotGet a slot of a component.Component
  • Slot name
Object
childDeprecated. This function is now called 'slot'.Component
  • Child name
Object
lengthGet the size of an array or of a String.Array

-

Number
itemGet the item of an array at a given index. Index starts at 0.Array
  • Index of the item
Object
firstGet the first item of an array.Array-Object
lastGet the last item of an array.Array-Object
removeFirstRemove the first item of the array return the array.Array-Array
removeLastRemove the last item of the array return the array.Array-Array
removeDuplicatesRemove the duplicates from an array.Array-Array
filterFilter the values of an array. Value is valid if equals to the given String, boolean or double.Array
  • Value of the value to filter
Array
display

Convert an array into a String using a format. Format is applied to each value of the array. Use [] to protect SFormat from resolve. Use \n for line break.

Array
  • Format to apply
String
ordExecute a query: slotPathOrd, bql or neql. Base: absolute or relative.Component
  • Query
Array
escapeEscape a String.String-String
unescapeUnescape a String.String-String
toFriendlyConvert a String to friendly case.String-String
fromFriendlyConvert a String from friendly case.String-String
fileNameReplace special chars (including accents) by _String-String
safeNameStripe accents and replace special chars by _String-String
substringReduce a String between two indexes.String
  • Start index
  • End index
String
substringFromEndRemove x characters from a String, starting at the end.String
  • Number of chars to remove
String
indexOfReturn the index of an input String.String
  • String to match
Number
replaceReplace an input String in the base.String
  • String to replace
  • String of replacement
String
prefixWill return the prefix followed by the base if the base is not null or empty.String
  • Prefix
String
suffixWill return the base followed by the suffix if the base is not null or empty.String
  • Suffix
String
splitSplit a String depending on a sequence of chars.String
  • String to split at
Array
splitRegexSplit a String depending on a regex.String
  • Regex to split at
Array
orEmptyWill return the base if the base is not null or empty.String

-

Boolean
toDynamicEnumConvert an array into a value to a dynamic enum.Array-DynamicEnum
toDynamicEnumsConvert an array of x elements into an array of x enums with only one value.Array-DynamicEnums
toStringConvert the base in a String.Object-String
toIntConvert the base in an integer.Object-Number
toDoubleConvert the base in a double.Object-Number
toOrdConvert the base in an ord.Object-Ord
toBrushConvert the base in a brush.Object-Brush
toTagGet the tag of the value of an enum.Object-String
toDisplayTagGet the display tag of the value of an enum.Object-String
toSimpleConvert the base in a Simple.Object
  • Type of the Simple (ex: baja:Color)
Simple
addAdd a number to another.Number
  • Number to add to base
Number
subtractSubtract a number to another.Number
  • Number to subtract from base
Number
multiplyMultiply a number to another.Number
  • Number to multiply base
Number
divideDivide a number to another.Number
  • Number to divide vase
Number
pxViewGet the ord of the file of a pxView.Component
  • Name of the px view
  • OR Index of the px view
  • OR nothing (will take first view)
Ord
isTypeReturn whether a component is from the given type or not.Component
  • Type (ex: baja:Folder)
Boolean
checkTypeReturn the base if it's from the given type.Component
  • Type (ex: control:ControlPoint)
Boolean
makeTypeCreate a new instance of a type.Component
  • Type (ex: control:BooleanWritable)
Object
existsReturn whether an object/slot exists, i.e. is not null.Object-Boolean
isNullReturn whether an object is null. Also see isInvalid() function.Object-Boolean
isEmptyReturn whether an array is empty.Array-Boolean
isInvalidReturn whether an object is null or a String is equals to "null", is empty or contains "err:".String-Boolean
propertyGet a property of a component identified by its name. Property includes name, value, flags and facets.Component
  • Name of the property
Object
propertiesGet all the properties of a component. Property includes name, value, flags and facets.Component-Array
frozenPropertiesGet all the frozen properties of a component. Property includes name, value, flags and facets.Component-Array
dynamicPropertiesGet all the dynamic properties of a component. Property includes name, value, flags and facets.Component-Array
tagPropertiesGet all the properties with a metadata flag of a component. Property includes name, value, flags and facets.Component-Array
numberExtract a number at the end of a String.String
  • Max characters count (ex: 2 if max number is 99)
String
addFacetsConcatenates facets.BFacets
  • Facets to add
BFacets
removeFacetsRemove a key from facets.BFacets
  • Key to remove
BFacets
formatResolve a BFormat or BSFormat slot on the last base.Component
  • Format to resolve
Object
methodCall a method on the base with the given parameters.Object
  • Method name
  • Parameters if needed
Object
methodWithCxCall a method on the base with the given parameters and the context.Object
  • Method name
  • Parameters if needed
Object
jsonExtract a value from a json. See JsonFormat documentation: JSON Key SelectorJson

See JsonFormat documentation

Json / Primitive
equalsReturn whether a member is equal to an other.

String / Double / Boolean

  • String
  • OR Double
  • OR Boolean
Boolean
likeReturn whether a String is like an other.String
  • String to compare to. Can start and/or end by wildcard *
Boolean
lessThanReturn whether a number is less than an other.Number
  • Number to compare to
Boolean
greaterThanReturn whether a number is greater than an other.Number
  • Number to compare to
Boolean
andReturn true if both conditions are valid.Boolean
  • Boolean to compare with base
Boolean
orReturn true if at least one of the conditions is valid.Boolean
  • Boolean to compare with base
Boolean
notReturn true if the base is false and false if the base is true.Boolean

-

Boolean
nodeGet the first node of the results. See nodes() method.Node / InfoSource
  • Level of the node
  • OR nothing
Node
nodes

For infoSources: get the nodes from which the component is source of on the given aspect.

For nodes: get the ascendants node of a given level.

Node / InfoSource
  • Level of the node
  • OR nothing
Node
infoSourceGet the infoSource of a source.Component-InfoSource
tagGet the value of a tag.Component
  • Name of the tag
Object
inRelGet the endpoint of the first inbound relation with the given id.Component
  • Id of the inbound relation
Component
outRelGet the endpoint of the first outbound relation with the given id.Component
  • Id of the outbound relation
Component
relGet the endpoint of the first relation with the given id in the given direction.Component
  • Direction: in, out or both
  • Id of the relation
Component
relationsGet the endpoints of all the relations with the given id in the given direction.Component
  • Direction: in, out or both
  • Id of the relation
Array
inLinkGet the endpoint of the first inbound link on the given slot.Component
  • Target slot name
Component
outLinkGet the endpoint of the first outbound link on the given slot.Component
  • Source slot name
Component
linkGet the endpoint of the first link on the given slot in the given direction.Component
  • Direction: in, out or both
  • Slot name
Component
linksGet the endpoints of all the links on the given slot in the given direction.Component
  • Direction: in, out or both
  • Slot name
Array
categoryGet a category created with a CategoryBlock.Component-Category
hasCategoryCheck if a component has the given category.Component
  • Category
Boolean
hasExactCategoryCheck if a component has only the given category.Component
  • Category
Boolean
hasCategoriesCheck if a component has the given categories.Component
  • Array of categories
Boolean
hasExactCategoriesCheck if a component has the only given categories.Component
  • Array of categories
Boolean
widgetGet a widget identified by an id.Base
  • Id of the widget (from Id Binding)
Widget
columnGet a column of a table. Column can be identified by name or index. Index is starting at 0. Index 0 is often timestamp, 1 is often status.Table
  • Index
  • OR name
Column
columnsGet all the columns of a tableTable-Array