mdstring
- Last UpdatedSep 05, 2024
- 2 minute read
This topic is about the MDSTRING data type.
Value syntax
{dic1={key1=value1}{key2=value2}}{dic2={key3=value3}}
Description
Dictionary of dictionaries (2 levels) field. It can be used to describe complex structures.
Special value assignment
The MDSTRING field supports a special value assignment to allow adding a new dictionary with a single entry, or replacing an existing entry in an already existing dictionary.
To use special value assignment
-
Use the following syntax.
"+dictionaryName,entryName=entryValue"
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="{dic1={entry1=value1}{entry2=value2}}{dic2={entry3=value3}{entry4=value4}{entry5=value5}}" />
<!-- special assignment -->
<!-- ................... -->
<!-- adding a new dictionary with a single entry-->
<setfield name="aDic.value" value="+dic3,entry6=value6" />
<!-- adding a new entry to existing dictionary -->
<setfield name="aDic.value" value="+dic3,entry7=value7" />
<!-- replacing and existing entry in an existing dictionary -->
<setfield name="aDic.value" value="+dic1,entry1=value10" />
Attributes
These are the attributes for MDSTRING.
|
Attribute |
Type |
Description |
|---|---|---|
|
[dic,key] or elementAt(dic,key) |
sstring |
To obtain the value associated to the key in a dictionary. |
|
contains(dic) |
sbool |
Determines if there is a dictionary matching specified name. |
|
containsKey(dic) |
sbool |
Determines if there is a dictionary matching specified name. |
|
containsKey(dic,key) |
sbool |
Determines if there is a dictionary matching specified name and containing a key matching specified one name. |
|
fromJSON(jsonValue) |
mdstring |
Returns a new MDSTRING populated by the given JSON structure. |
|
getDictionary(dic) |
dstring |
Returns the dictionary matching specified name if exists. |
|
keys() |
mstring |
Returns the list of the dictionary names. |
|
keys(dic) |
mstring |
Returns the list of the dictionary keys. |
|
remValue(dic,key) |
mdstring |
Returns a copy of the MDSTRING and removes from it an existent key from indicated given dictionary. |
|
remValue(dic) |
mdstring |
Returns a copy of the MDSTRING and removes the specified dictionary if existent. |
|
setValue(dic,key,val) |
mdstring |
Returns a copy of the MDSTRING and adds or updates a key value into indicated dictionary. |
|
toJSON() |
sstring |
Returns a JSON representation of the MDSTRING. |
|
type |
sstring |
Returns the type name. |