Skip to content
Snippets Groups Projects
Commit 6f7d7bb4 authored by stevereis's avatar stevereis
Browse files

fix : shorter syntax jsonata

parent 2037937e
No related branches found
No related tags found
No related merge requests found
...@@ -5,9 +5,7 @@ import * as jsonata from 'jsonata'; // old import style needed because of 'expor ...@@ -5,9 +5,7 @@ import * as jsonata from 'jsonata'; // old import style needed because of 'expor
export const transientToTable = jsonata(` export const transientToTable = jsonata(`
( (
$e := function($x) {( $e := function($x) {($x != null) ? $x : ''};
($x != null) ? $x : ''
)};
$fn := function($o, $prefix) { $fn := function($o, $prefix) {
$each($o, function($v, $k) {( $each($o, function($v, $k) {(
...@@ -32,9 +30,8 @@ export const transientToTable = jsonata(` ...@@ -32,9 +30,8 @@ export const transientToTable = jsonata(`
['Nulls', $p.*.($e(num_nulls))], ['Nulls', $p.*.($e(num_nulls))],
$p.*.data.($fn($)) ~> $reduce(function($a, $b) { $p.*.data.($fn($)) ~> $reduce(function($a, $b) {
$each($a, function($v, $k) {( $each($a, function($v, $k) {(
$val := $lookup($b,$k);
{ {
$k : [$v, ($val != null) ? $val : ''] $k : [$v, $e($lookup($b,$k))]
} }
)}) ~> $merge() )}) ~> $merge()
}) ~> $each(function($v, $k) {$append($k,$v)}) }) ~> $each(function($v, $k) {$append($k,$v)})
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment