Script to copy a reference _tag_ field into other json objects, and script to count by unique json field
This commit is contained in:
23
addBindings.jq
Normal file
23
addBindings.jq
Normal file
@@ -0,0 +1,23 @@
|
||||
.
|
||||
# Sort first
|
||||
| walk(
|
||||
if type == "object" and has("tags") then
|
||||
.tags |= sort_by(.name)
|
||||
end
|
||||
)
|
||||
# so object positions are predictable
|
||||
| .tags[3].tags[1].tags as $baseData
|
||||
| walk(
|
||||
# Removes .Tags.Controller Tags from the plcName parameter
|
||||
if type == "object" and has("plcName") then
|
||||
.plcName.value |= rtrimstr(".Tags.Controller Tags")
|
||||
elif type == "object" and has("plcname") then
|
||||
.plcname.value |= rtrimstr(".Tags.Controller Tags")
|
||||
end
|
||||
)
|
||||
# and can be used as the base line to setup the other objects
|
||||
| walk(
|
||||
if type == "object" and .name? == "Data" then
|
||||
.tags = $baseData
|
||||
end
|
||||
)
|
||||
4
countTypes.jq
Normal file
4
countTypes.jq
Normal file
@@ -0,0 +1,4 @@
|
||||
.
|
||||
| .tags
|
||||
| map(.typeId)
|
||||
| unique
|
||||
Reference in New Issue
Block a user