-
Notifications
You must be signed in to change notification settings - Fork 0
test
simenjorgensen edited this page Feb 7, 2019
·
3 revisions
As you can see in the examples below we want to add the "City" and "Municipality" from another dataset to the source. In the two examples we have the same source but the difference lie in how we use the "apply-hops".
In the first case we "add" a new property called "order-data" which you can see in the results creates a dictionary containing "City" and "Municipality" in "order-data".
"transform": {
"type": "dtl",
"rules": {
"default": [
["copy", "*"],
["add","order-data",
["apply-hops", "foobar", {
"datasets": ["difi-postnummer dip"],
"where": [
["eq", "_S.ZipCode", "dip.postnummer"]
]
}]
],
["add", "baz", "_T.foo.postnummer-ni"]
],
"foobar": [
["add", "Municipality", "_S.kommunenavn"],
["add", "City", "_S.poststed"]
]
}
}
}Results:

In the second example, instead of adding the "apply-hops", we use "merge". This will add the "City" and "Municipality" as properties in the source.
"transform": {
"type": "dtl",
"rules": {
"default": [
["copy", "*"],
["merge",
["apply-hops", "foobar", {
"datasets": ["difi-postnummer dip"],
"where": [
["eq", "_S.ZipCode", "dip.postnummer"]
]
}]
],
["add", "baz", "_T.foo.postnummer-ni"]
],
"foobar": [
["add", "Municipality", "_S.kommunenavn"],
["add", "City", "_S.poststed"]
]
}
}
}Results:
