I have un-normalised data held in a string field as optional key value pairs.
Here’s a row example:
‘num=04^author=1^dataizd=^dataizm=^tom=12^link=^kolon=^comment=’
I would like to split this into disparate fields ignoring empty data. I have read much of the docs, and watched most tutorials but so far haven’t achieved what I am looking for. I am sure that this must be a common task that is already catered for in CloverETL but I don’t have the experience or vocabulary to identify the approved method. Hence, I’m reaching out to the community.
This is how I am approaching it (although it isn’t working):
$out.0.created_by = str2integer(find($in.0.data, "author=([0-9]*)\\^", 1)[0] : "0");
$out.0.modified = str2date(find($in.0.data, "dataizd=([0-9][0-9]\\.[0-9][0-9]\\.\\d{4})\\^")[1]:"01.01.1970", "dd.MM.yyyy");
$out.0.publish_down = str2date(find($in.0.data, "dataizm=([0-9][0-9]\\.[0-9][0-9]\\.\\d{4})\\^")[1]:"01.01.1970", "dd.MM.yyyy");
$out.0.attribs = find($in.0.data, "tom=(\\d*)\\^")[1]:"";
$out.0.link_ref = str2integer(find($in.0.data, "kolon=(\\d.*)\\^")[1]:"0");
$out.0.metadesc = find($in.0.data, "comment=(.*)")[1]:"";
I would appreciate some help with my first foray into ETL.
Thanks
Sadler