I understand much better now. Thanks for explaining again.
I believe I was able to simply your code. See below.
Maybe there is a better way to solve your problem, but I don’t know enough about OIDs.
Does this work for you?
replacementPairs = [
{target: "EATON", replacement: "Maunufacturer: EATON" },
{target: "PXGX UPS + EATON BladeUPS", replacement: "Model: PXGX UPS + EATON BladeUPS" },
{target: "2.6.0.28-ups", replacement: "FirmwareVersion: 2.6.0.28-ups" },
{target: "ID: *", replacement: "SerialNumber: ID: *" }
];
replaceRawValue(rawValue) =
max(foreach replacementPair in replacementPairs
where matches(rawValue, replacementPair.target)
select replace(rawValue, replacementPair.target, replacementPair.replacement));
foreach snmpSource in network.externalSources.snmpSources
foreach device in network.devices
where device.name == snmpSource.name
let snapshotInfo = device.snapshotInfo
foreach output in snmpSource.outputs
foreach rawOidEntry in output.rawOidEntries
let replacedValue = replaceRawValue(rawOidEntry.rawValue)
select {
DeviceName: snmpSource.name,
SnapshotResult: when snmpSource.snapshotInfo.result is
collectionFailed -> "collectionFailed";
completed -> "completed";
processingFailed -> "processingFailed",
CollectionIp: snmpSource.snapshotInfo.collectionIp,
rawValue: if isPresent(replacedValue) then replacedValue else rawOidEntry.rawValue
}