We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi all,
I was trying to parse this data:
<root> <Device Name="PIKO 3.6-1 MP plus" Type="Inverter" Platform="Net16" HmiPlatform="HMI17" NominalPower="3600" UserPowerLimit="nan" CountryPowerLimit="nan" Serial="763168EH006917660002" OEMSerial="10351939" BusAddress="1" NetBiosName="INV006917660002" WebPortal="PIKO Solar Portal" ManufacturerURL="kostal-solar-electric.com" IpAddress="192.168.1.128" DateTime="2024-06-26T10:07:27" MilliSeconds="769"> <Measurements> <Measurement Value="247.0" Unit="V" Type="AC_Voltage"/> <Measurement Value="10.234" Unit="A" Type="AC_Current"/> <Measurement Value="2520.8" Unit="W" Type="AC_Power"/> <Measurement Value="2521.3" Unit="W" Type="AC_Power_fast"/> <Measurement Value="50.068" Unit="Hz" Type="AC_Frequency"/> <Measurement Value="623.2" Unit="V" Type="DC_Voltage"/> <Measurement Value="4.289" Unit="A" Type="DC_Current"/> <Measurement Value="624.4" Unit="V" Type="LINK_Voltage"/> <Measurement Value="6439.1" Unit="W" Type="GridPower"/> <Measurement Value="0.0" Unit="W" Type="GridConsumedPower"/> <Measurement Value="6439.1" Unit="W" Type="GridInjectedPower"/> <Measurement Value="0.0" Unit="W" Type="OwnConsumedPower"/> <Measurement Value="70.0" Unit="%" Type="Derating"/> </Measurements> </Device> </root>
Using UQL, I'm able to parse it and obtain this JSON:
parse-xml | scope "root.Device.Measurements.Measurement"
[ { "@_Value": "234.2", "@_Unit": "V", "@_Type": "AC_Voltage" }, { "@_Value": "5.827", "@_Unit": "A", "@_Type": "AC_Current" }, { "@_Value": "1363.2", "@_Unit": "W", "@_Type": "AC_Power" }, { "@_Value": "1364.0", "@_Unit": "W", "@_Type": "AC_Power_fast" }, { "@_Value": "49.986", "@_Unit": "Hz", "@_Type": "AC_Frequency" }, { "@_Value": "576.8", "@_Unit": "V", "@_Type": "DC_Voltage" }, { "@_Value": "2.501", "@_Unit": "A", "@_Type": "DC_Current" }, { "@_Value": "577.9", "@_Unit": "V", "@_Type": "LINK_Voltage" }, { "@_Value": "2849.6", "@_Unit": "W", "@_Type": "GridPower" }, { "@_Value": "0.0", "@_Unit": "W", "@_Type": "GridConsumedPower" }, { "@_Value": "2849.6", "@_Unit": "W", "@_Type": "GridInjectedPower" }, { "@_Value": "0.0", "@_Unit": "W", "@_Type": "OwnConsumedPower" }, { "@_Value": "70.0", "@_Unit": "%", "@_Type": "Derating" } ]
However, I would like to set the timestamp (root.Device.@_DateTime) as a new key-pair value for each list entry.
root.Device.@_DateTime
Desired output:
[ { "@_Value": "234.2", "@_Unit": "V", "@_Type": "AC_Voltage", "timestamp": "2024-06-26T10:07:27" }, { "@_Value": "5.827", "@_Unit": "A", "@_Type": "AC_Current", "timestamp": "2024-06-26T10:07:27" }, { "@_Value": "1363.2", "@_Unit": "W", "@_Type": "AC_Power", "timestamp": "2024-06-26T10:07:27" }, { "@_Value": "1364.0", "@_Unit": "W", "@_Type": "AC_Power_fast", "timestamp": "2024-06-26T10:07:27" }, { "@_Value": "49.986", "@_Unit": "Hz", "@_Type": "AC_Frequency", "timestamp": "2024-06-26T10:07:27" }, { "@_Value": "576.8", "@_Unit": "V", "@_Type": "DC_Voltage", "timestamp": "2024-06-26T10:07:27" }, { "@_Value": "2.501", "@_Unit": "A", "@_Type": "DC_Current", "timestamp": "2024-06-26T10:07:27" }, { "@_Value": "577.9", "@_Unit": "V", "@_Type": "LINK_Voltage", "timestamp": "2024-06-26T10:07:27" }, { "@_Value": "2849.6", "@_Unit": "W", "@_Type": "GridPower", "timestamp": "2024-06-26T10:07:27" }, { "@_Value": "0.0", "@_Unit": "W", "@_Type": "GridConsumedPower", "timestamp": "2024-06-26T10:07:27" }, { "@_Value": "2849.6", "@_Unit": "W", "@_Type": "GridInjectedPower", "timestamp": "2024-06-26T10:07:27" }, { "@_Value": "0.0", "@_Unit": "W", "@_Type": "OwnConsumedPower", "timestamp": "2024-06-26T10:07:27" }, { "@_Value": "70.0", "@_Unit": "%", "@_Type": "Derating", "timestamp": "2024-06-26T10:07:27" } ]
I was wondering if it would be possible to create a new function for extend to set static values to a column.
extend
Thanks for your help!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi all,
I was trying to parse this data:
Using UQL, I'm able to parse it and obtain this JSON:
However, I would like to set the timestamp (
root.Device.@_DateTime
) as a new key-pair value for each list entry.Desired output:
I was wondering if it would be possible to create a new function for
extend
to set static values to a column.Thanks for your help!
The text was updated successfully, but these errors were encountered: