Open aquast opened 1 year ago
I had a quick look at the transformation.
Try to use the list
-bind like this:
input:
"test" : [ {
"key" : [ "value", "more_value", "even_more_value" ],
"foo" : "bar1",
"test": "test1"
}, {
"key" : [ "less_value", "little_value", "no_value" ],
"foo" : "bar2",
"test": "test2"
} ]
do list(path:"test[]","var":"$i")
move_field("$i.foo","$i.dc:foo")
end
output:
"test" : [ {
"key" : [ "value", "more_value", "even_more_value" ],
"dc:foo" : "bar1",
"test": "test1"
}, {
"key" : [ "less_value", "little_value", "no_value" ],
"dc:foo" : "bar2",
"test": "test2"
} ]
You do not have root access if you do not use the "var" option. (Hint: unfortunatly the only option in fix that needs "
is var)
Hi @TobiasNx ,
your proposal with "var" solved the issue for me. So maybe it's an issue of documentation rather than coding
Thank you : (thumbs up)
Hi @TobiasNx ,
your proposal with "var" solved the issue for me. So maybe it's an issue of documentation rather than coding
Thank you : (thumbs up)
@aquast
also have a look at my playground link.
if you are working with newly created arrays, you should use set_array("newArray[]")
and copy or move values like this into it: copy_field("oldField.value","newArray[].$append")
@blackwinter: should we delete the documentation of the list
-bind without variable since it is not very useful?
should we delete the documentation of the
list
-bind without variable since it is not very useful?
No, I don't think so. It's certainly limited as long as we don't support the .
path operator, but there might still be legitimate use cases (which I don't recall off the top of my head).
Thank you for all your feedback.
If you asked me as a newbie user I'd like to have the list
-bind without var with respect to my growing learners skills. Additionaly having a code example with "var":"value" as parameter would serve me better.
If I use the
do list
command with an array of one item the result differs from an array of n items.It looks like the command can not be executed correctly with an array of one.
Please see attached files
Attachments.zip