AnsweredAssumed Answered

UFL - How to create INI file when message statements is null

Question asked by QuenaultR on Sep 16, 2020

I need to take all parameters and all values. How can I do that ?

I have this JSON file, how to create the correct INI to store in PI ? 

Which selector can I put to loop all parameters and all values ?

 

-------------------------------------------------------------------------------------------------------------------------------------------

INI FILE

-------------------------------------------------------------------------------------------------------------------------------------------

 

'===========Define Variables==========
[FIELD]
FIELD(9).NAME="TimeStamp"
FIELD(9).TYPE="DateTime"
FIELD(9).FORMAT="SECONDS_GMT"
FIELD(11).NAME="Attribute"
FIELD(11).TYPE="String"
FIELD(14).NAME="TagBaseName"
FIELD(14).TYPE="String"

'==============Define Message Statements========
[MSG]
MSG(1).NAME="????"
'===============Extract data=================
'===============Store PI Points==============
[DATA]

????.FILTER=C1=="*"
TagBaseName = "Test_Result_"

FOREACH (JsonGetItem(__MESSAGE,"???")) DO

   TimeStamp = JsonGetValue(__ITEM,"_timestamp")

   Attribute = "ConfigPressureUnit"
   IF JsonGetValue(__ITEM, Attribute) IS NOT NULL THEN
      StoreInPI(TagBaseName & Attribute,, TimeStamp,JsonGetValue(__ITEM, Attribute))
   ENDIF

...

 

ENDFOR

...

 

 

 

-------------------------------------------------------------------------------------------------------------------------------------------

JSON FILE

-------------------------------------------------------------------------------------------------------------------------------------------

 

{
"ConfigPressureUnit": "mbar",
"CreatedBy": "Admin",
"DeviceData": {
"HardwareSerialNumbers": {
"AU": "",
"AU_EX": "",
"EU": "",
"INTPVT": "",
"INTVOL": "",
"MU": "",
"PROCESS_P_SENS": "",
"SAFETY_P_SENS": ""
},
"HostNames": {
"eth0": "sc5-1b5d2f",
"eth1": "sc5-1b5d2f"
},
"SerialNumber": "38204786",
"SoftwareVersion": {
"AU": "07-59-01.01.11.180917",
"AU_BOOT": "0.0.0",
"MU": "01.03.05.200625"
},
"Type": "SC5+"
},
"ResultManagVers": "1.0.0",
"WorkFlowName": "Prog 24 : KA2V002PV2G",
"WorkFlowType": "DIF",
"WorkflowVersion": "0.9.0",
"_id": "dee7d2cf-9d33-4dad-990b-f0951ae97891",
"_timestamp": 1600085096,
"abortComment": "vtb",
"acceptance": "ABORTED",
"calibrated": true,
"endTime": 1600085086,
"error": "ERR_SUPPLY_PRESSURE_IS_TOO_LOW_PLEASE_INCREASE_TO_OVER_PRESSURE",
"errortext": "La pression d'alimentation est trop faible. Augmentez la pression à plus de 4000 mbar.",
"errorvariables": [
"4000 mbar"
],
"linechart": [],
"protocolData": [
{
"key": "Building",
"label": "Building",
"value": "building120"
},
{
"key": "Company",
"label": "Company",
"value": "testcompany"
},
{
"key": "Department",
"label": "Department",
"value": "test"
},
{
"key": "Filter",
"label": "Filter",
"value": "test"
},
{
"key": "FilterLine",
"label": "FilterLine",
"value": "1"
},
{
"key": "Filter_lot",
"label": "Filter_lot",
"value": "1234"
},
{
"key": "Filter_use_before",
"label": "Filter_use_before",
"value": "20102020"
},
{
"key": "Housing",
"label": "Housing",
"value": "1"
},
{
"key": "Manufact_site",
"label": "Manufact_site",
"value": "test"
},
{
"key": "Product",
"label": "Product",
"value": "test"
},
{
"key": "Product_lot",
"label": "Product_lot",
"value": "test"
},
{
"key": "Test_gas",
"label": "Test_gas",
"value": "Air"
},
{
"key": "Water_quality",
"label": "Water_quality",
"value": "good"
},
{
"key": "wettingMedium",
"label": "wettingMedium",
"value": "IPA/WFIF 60/40"
}
],
"startTime": 1600085065,
"testData": [],
"userFirstname": "Unnamed",
"userJobposition": "Administrator",
"userLastname": "Administrator",
"username": "Admin",
"signatures": {
"requiredSignatures": 2
},
"workflowParams": {
"_id": "6aece48d-5c4d-4f7a-a96b-efbe6cadce64",
"accessoryKit": false,
"advanced": false,
"autoMeasTime": false,
"measuringTime": {
"decimals": 0,
"high": 5,
"id": "phy",
"low": 5,
"rel": true,
"unit": "min",
"value": 5
},
"stabilisationTime": {
"decimals": 0,
"high": 5,
"id": "phy",
"low": 5,
"rel": true,
"unit": "min",
"value": 5
},
"useExtRefVolume": false,
"volumeDetermination": "MEASUREMENT",
"pressureUnit": "mbar",
"maximalDiffusion": {
"decimals": 2,
"high": 1.3,
"id": "phy",
"low": 1.3,
"rel": true,
"unit": "mL/min",
"value": 1.3
},
"numberOfFilters": 1,
"testPressure": {
"decimals": 0,
"high": 830,
"id": "phy",
"low": 830,
"rel": true,
"unit": "mbar",
"value": 830
},
"totalMaximalDiffusion": {
"decimals": 2,
"high": 1.3,
"id": "phy",
"low": 1.3,
"rel": true,
"unit": "mL/min",
"value": 1.3
}
},
"jobName": "result_Prog24KA2V002PV2G_2020-09-14-140456-CEST"
}

Outcomes