When working with Lotus Domino databases I needed a simple and compact way to pull data from one database into another.
I wanted something that was human-readable, extensible, simple, order-agnostic and simple to process. After some experimentation I settled on an old idea to use delimited fields. But, I wanted to be able to add and remove fields and have them in any order. To do this I added a field name.
The format is
Compact = Field* ~
Field = ~ fieldname : data
The only constraints were:
- The field name could not start with a "~"
- The field name could not contain a ":"
- The data could not contain a "~"
To extract a data element we used code like this:
@left( @right( compact ; "~" + fieldname + ":" ); "~" )This gets the string right of the "~fieldname:" and then returns data left of the "~".
Similar code can be used to extract the XML data:
@left( @right( XMLData ; "<" + fieldname + ">" ); "</" + fieldname + ">" )(It is XML-like so you need to handle escape sequences yourself.)
Here are some examples. You can see we even carried code and XML-like data as data.
~ID:TS~SubID:VP~Icon:44~
~RCCode:AM~RCTitle:Asset Management~MCode:~MCustCode:
~LocA:PTSA13~Location:George St 47, Level 12N Conference Rm~Lat:30.123456~Long:151.