Last active
February 23, 2023 20:19
-
-
Save scarabaeus/b9f77921df87a6cf5d2bbd96e2be4ce3 to your computer and use it in GitHub Desktop.
Typed value transformation for writing UI transformation to core transformation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Expression to be executed on the FE to create a serialized expression to be evaluated by Core (SQL as the example) */ | |
{ | |
"typedValues": [ | |
{ | |
"value": "John", | |
"type": "string" | |
}, | |
{ | |
"value": "Doe", | |
"type": "string" | |
}, | |
{ | |
"value": "$number($.amount)", | |
"type": "number" | |
}, | |
{ | |
"value": "Company Name", | |
"type": "string" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
"John", | |
"Doe", | |
$number($.amount), | |
"Company Name" | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"[\"John\",\"Doe\",$number($.amount),\"Company Name\"]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( | |
$values := function($acc, $item, $index, $entireArray) { | |
$acc & ($item.type = "number" ? $item.value : "\"" & $item.value & "\"") & ($count($entireArray) != ($index + 1) ? "," : "") | |
}; | |
"[" & $reduce($.typedValues, $values, "") & "]" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This would be used in the "Save Transformation" portion of a Third-Party FE node schema.