dstring
- Last UpdatedSep 05, 2024
- 2 minute read
This topic is about the DSTRING data type.
Value syntax
{key1=value1}{key2=value2} (older key one=value one, key two=anotherValue)
Description
Dictionary field that contains a list of different key-value couples. Can be used to define custom parameters for a command node. When setting new values the content is updated not overridden.
Special value assignment
The DSTRING field supports a special value assignment to allow adding a new entry in the dictionary or replacing an existing one.
To use special value assignment
-
Add the '+' prefix to the value set.
value="+{entry4=value4}"
This approach is alternative to using the setValue attribute.
Full example of standard assignment and special assignment syntax.
<!-- standard assignment -->
<!-- ................... -->
<!-- overriding the content of the whole dictionary-->
<setfield name="aDic.value" value="{entry1=value1}{entry2=value2}{entry3=value3}" />
<!-- special assignment -->
<!-- ................... -->
<!-- adding a new entry in the dictionary-->
<setfield name="aDic.value" value="+{entry4=value4}" />
<!-- replacing an existing entry in the dictionary -->
<setfield name="aDic.value" value="+{entry2=value10}" />
Attributes
These are the attributes for DSTRING.
|
Attribute |
Type |
Description |
|---|---|---|
|
containsKey(text) |
sbool |
Returns True if one or more keys of the dictionary contains the text. |
|
contains(text) |
sbool |
Returns True if one or more keys of the dictionary contains the text. |
|
fromJSON(jsonValue) |
dstring |
Returns a new DSTRING populated by the given JSON structure. |
|
isModified |
sbool |
Set to True in the frame where the value of this field is modified. |
|
keys() |
mstring |
Returns the list of the dictionary names. |
|
[key] or elementAt(key) |
sstring |
To obtain the value associated to the key. |
|
length |
sint |
Returns the number of elements. |
|
remValue(key) |
dstring |
Returns a copy of the DSTRING and removes the specified key if existent. |
|
setValue(key,val) |
dstring |
Returns a copy of the DSTRING and adds or updates a key value. |
|
toJSON() |
sstring |
Returns a JSON representation of the DSTRING. |
|
type |
sstring |
Returns the type name. |