Added a filtering step on __addBindings.jq__
This commit is contained in:
@@ -1,23 +1,30 @@
|
|||||||
|
# Filter first
|
||||||
.
|
.
|
||||||
|
| debug("Filtering...")
|
||||||
|
| .tags[]
|
||||||
|
|= select(.typeId == "Cooling/PLC_AB/PLC_AB_Auto_v3")
|
||||||
# Sort first
|
# Sort first
|
||||||
| walk(
|
| debug("Sorting...")
|
||||||
if type == "object" and has("tags") then
|
| walk( if type == "object" and has("tags") then .tags |= sort_by(.name) end )
|
||||||
.tags |= sort_by(.name)
|
|
||||||
end
|
|
||||||
)
|
|
||||||
# so object positions are predictable
|
# so object positions are predictable
|
||||||
| .tags[3].tags[1].tags as $baseData
|
| 2 as $pos
|
||||||
| walk(
|
| .tags[0].tags[$pos].tags as $baseData
|
||||||
# Removes .Tags.Controller Tags from the plcName parameter
|
| debug("Modifying tags...")
|
||||||
if type == "object" and has("plcName") then
|
| .tags
|
||||||
.plcName.value |= rtrimstr(".Tags.Controller Tags")
|
|= map(
|
||||||
elif type == "object" and has("plcname") then
|
.
|
||||||
.plcname.value |= rtrimstr(".Tags.Controller Tags")
|
| if .parameters.plcName.value then
|
||||||
|
.parameters.plcName.value |= rtrimstr(".Tags.Controller Tags")
|
||||||
|
elif .parameters.plcname.value then
|
||||||
|
.parameters.plcname.value |= rtrimstr(".Tags.Controller Tags")
|
||||||
end
|
end
|
||||||
)
|
| if .tags
|
||||||
# and can be used as the base line to setup the other objects
|
and .tags[$pos].name == "Data"
|
||||||
| walk(
|
and .tags[$pos].tagType == "Folder"
|
||||||
if type == "object" and .name? == "Data" then
|
then
|
||||||
.tags = $baseData
|
.tags[$pos].tags |= $baseData
|
||||||
|
else
|
||||||
|
.
|
||||||
|
| debug("Data folder not found")
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user