Member since
08-10-2022
27
Posts
1
Kudos Received
2
Solutions
My Accepted Solutions
Title | Views | Posted |
---|---|---|
1622 | 03-16-2023 02:57 AM | |
9989 | 08-29-2022 04:50 AM |
05-26-2023
12:13 AM
Hi Community, hope someone can help me to build this transform: My Input: {
"Orders": [{
"Headers": {
"UniqShipment": "0"
},
"Goods": [{
"GoodsTypeID": 3,
"GoodsTypeName": "ALTRI MOBILI LEGNO",
"GoodsDetails": [{
"Packs": 1
}, {
"Packs": 1
}, {
"Packs": 1
}]
}],
"References": [{
"TypeReference": "DT",
"ValueReference": "006611",
"DateReference": "2023-04-14"
}, {
"TypeReference": "CM",
"ValueReference": "JOHN"
}, {
"TypeReference": "OC",
"ValueReference": "V1250-0010"
}, {
"TypeReference": "RG",
"ValueReference": "TRCA_CATR726240_CA_006611_14_04_2023.json"
}]
}]
} My Desired Output: {
"header": {
"UniqShipment": "0"
},
"rows": {
"GoodsTypeName": ["ALTRI MOBILI LEGNO", "ALTRI MOBILI LEGNO", "ALTRI MOBILI LEGNO"],
"Packs": [1, 1, 1],
"ValueReference": ["V1250-0010", "V1250-0010", "V1250-0010"]
}
} My Transformation so far: [
{
"operation": "shift",
"spec": {
"Orders": {
"*": {
"Headers": "header",
"Goods": {
"*": {
"GoodsDetails": {
"*": {
"@(2,GoodsTypeName)": "rows.GoodsTypeName",
"Packs": "rows.Packs"
}
}
}
}
}
}
}
}
] Which Produce the following result: {
"header" : {
"UniqShipment" : "0"
},
"rows" : {
"GoodsTypeName" : [ "ALTRI MOBILI LEGNO", "ALTRI MOBILI LEGNO", "ALTRI MOBILI LEGNO" ],
"Packs" : [ 1, 1, 1 ]
} Now i need to make the last part: Based on the value of TypeReference which has to be "OC" then add the list of ValueReference per each element of "rows array" like this: {
"header": {
"UniqShipment": "0"
},
"rows": {
"GoodsTypeName": ["ALTRI MOBILI LEGNO", "ALTRI MOBILI LEGNO", "ALTRI MOBILI LEGNO"],
"Packs": [1, 1, 1],
"TypeReference": ["V1250-0010", "V1250-0010", "V1250-0010"]
}
} Many Thanks for your help, appreciate!
... View more
Labels:
- Labels:
-
Apache NiFi
04-19-2023
12:29 PM
Hello, with this topic i need a clue. I have a text based data, this is an example row: CA20230405112337BOL006057 20230405V1260 2023021000409I 311003000102504 CA20230405112337BOL006057 20230405V1260 2023021000509I 311003000102504 I need to convert to json but: 1 - i need to remove all spaces in between 2 - i need to separate fields with a separator in order to create a schema and make a conversion Example: CA;20230405;bla bla bla CA;20230405;bla bla bla How can i achieve this? Is there any other way to do that? Many Thabks
... View more
Labels:
- Labels:
-
Apache NiFi
03-16-2023
02:57 AM
This should work, in the past i've tried the same command with ExecuteProcess but it didn't accept upstream connections. Your solution is working great! Many thabks for your supporto.
... View more
03-16-2023
01:55 AM
Hi, tried your suggestion, however in that case this is the error:
... View more
03-15-2023
10:18 AM
Hello, hope someone can point me in the right direction. I need to delete all files starting with some attributes value, so based on Linux way it should be something like this: rm -f /opt/my_path/myfile_* I decided to use Execute Stream Command in this way: The path seem correct, the command generated, pasted into a Linux shell is working fine, however the processor did not delete the files. If i try with a specific file it works fine. Seems that * is not permitted, any clue? Many Thanks to everybody...
... View more
Labels:
- Labels:
-
Apache NiFi
10-18-2022
07:31 AM
Hi community, i'm fighting with my JOLT transform, hope someone can help me on this. I have the following json flow file: [
{
"StartName": "<My_Start_Name_1>",
"StartAddress": "<My_Start_Address_1>",
"EndName": "<My_End_Name_1>",
"EndAddress": "My_End_Address_1",
"CubeSped": 0.58,
"WeightSped": 36
},
{
"StartName": "<My_Start_Name_2>",
"StartAddress": "<My_Start_Address_2>",
"EndName": "<My_End_Name_2>",
"EndAddress": "My_End_Address_2",
"CubeSped": 0.88,
"WeightSped": 22
}
] My expected result should be: {
"Data": {
"MessageId": "<My_Random_ID>",
"MessageDate": "<My_Current_Date>",
"Client": "<My_Customer>",
"Order": [
{
"ProcessType": {
"ReturnOrder": {
}
},
"FreightTerm": "PointOfUse",
"OrderNumber": "123456789160X",
"OrderNumber2": "123456789160X",
"TransmissionCommand": "Create",
"SequenceNumber": "1",
"SenderAbbreviation": "Test",
"CustomerAddress": {
"Name": "<My_Start_Name_1>",
"Street": "<My_Start_Address_1>"
},
"ShipmentAddress": {
"Name": "<My_End_Name_1>",
"Street": "<My_End_Address_1>"
},
"Volume": "1",
"Weight": "365"
},
{
"ProcessType": {
"ReturnOrder": {
}
},
"FreightTerm": "PointOfUse",
"OrderNumber": "123456789160X",
"OrderNumber2": "123456789160X",
"TransmissionCommand": "Create",
"SequenceNumber": "1",
"SenderAbbreviation": "Test",
"CustomerAddress": {
"Name": "<My_Start_Name_2>",
"Street": "<My_Start_Address_2>"
},
"ShipmentAddress": {
"Name": "<My_End_Name_2>",
"Street": "<My_End_Address_2>"
},
"Volume": "1",
"Weight": "365"
}
]
}
} Currently my spec are: [
{
"operation": "shift",
"spec": {
"*": {
"CubeSped": "Order[&1].Volume",
"WeightSped": "Order[&1].Weight",
"DocNumLDC": "Order[&1].OrderNumber",
"StartName": "Order[&1].CustomerAddress.Name",
"StartAddress": "Order[&1].CustomerAddress.Street",
"EndName": "Order[&1].ShipmentAddress.Name",
"EndAddress": "Order[&1].ShipmentAddress.Street"
}
}
}, {
"operation": "default",
"spec": {
"Order[]": {
"*": {
"top-level": {
"ProcessType": {
"ReturnOrder": ""
},
"FreightTerm": "PointOfUse",
"OrderNumber2": "123456789160X",
"TransmissionCommand": "Create",
"SequenceNumber": "1",
"SenderAbbreviation": "Test"
}
}
}
}
}
] Which becomes: {
"Order" : [ {
"Volume" : 0.58,
"Weight" : 36,
"CustomerAddress" : {
"Name" : "<My_Start_Name_1>",
"Street" : "<My_Start_Address_1>"
},
"ShipmentAddress" : {
"Name" : "<My_End_Name_1>",
"Street" : "My_End_Address_1"
},
"top-level" : {
"TransmissionCommand" : "Create",
"ProcessType" : {
"ReturnOrder" : ""
},
"FreightTerm" : "PointOfUse",
"SequenceNumber" : "1",
"SenderAbbreviation" : "Test",
"OrderNumber2" : "123456789160X"
}
}, {
"Volume" : 0.88,
"Weight" : 22,
"CustomerAddress" : {
"Name" : "<My_Start_Name_2>",
"Street" : "<My_Start_Address_2>"
},
"ShipmentAddress" : {
"Name" : "<My_End_Name_2>",
"Street" : "My_End_Address_2"
},
"top-level" : {
"TransmissionCommand" : "Create",
"ProcessType" : {
"ReturnOrder" : ""
},
"FreightTerm" : "PointOfUse",
"SequenceNumber" : "1",
"SenderAbbreviation" : "Test",
"OrderNumber2" : "123456789160X"
}
} ]
} The point is: is there any way to move elements on top? is there a better way to achieve the result? Does anything else can be used instead of JOLT? The result schema is needed after in order to covert everything into xml. Many thanks for any help, appreciate.
... View more
Labels:
- Labels:
-
Apache NiFi
10-12-2022
07:59 AM
Hi guys, hope someone can explain this strange behavior. I've created 2 different parameter context, let's say: Staging with #{db_host} = 192.168.1.2 Production with #{db_host} = 192.168.1.1 This #{db_host} is placed into a DBCPConnectionPool in order to switch from Staging to Production easily. The problem is that, when i change from Staging to Production in the Process Group general tab it still keeps the value of Staging instead of Production. Does any additional step is required? IS there any cache to delete or anything relevant? Many Thanks
... View more
Labels:
- Labels:
-
Apache NiFi
10-11-2022
08:22 AM
Thanks for the update, however that's is the problem. The Query Record does not fit my needs cause cannot implement the logic. Note that the json doesn't have always all situation codes, so the pseudo code should be: Grab the element with sit_code = POD only if present, otherwise go further with others. Any help is appreciate. Many Thanks
... View more
10-11-2022
07:34 AM
Hi guys, hope anyone can point me on the right direction. I have the following flow file: [ {
"version" : "5",
"type" : "REPORT",
"dp_code" : "DHA592",
"field4" : "83482227299911",
"field5" : "83482227299911",
"platform_name" : "GHESTEM LA CHAPELLE",
"field7" : "01143200",
"field8" : "72801371220938",
"field9" : "72801371220938",
"carrier_name" : "",
"shipper_name" : "",
"field12" : "",
"consignee_name" : "",
"consignee_code" : "",
"consignee_address" : "",
"consignee_city" : "",
"field17" : "",
"ldc_number" : "",
"ldc_date" : "",
"shipment_number" : "2022115144",
"shipment_code" : "2022115144/SH",
"field22" : "",
"field23" : "",
"field24" : "",
"field25" : "liv.cfm",
"situation_code" : "LIV",
"justification_code" : "CFM",
"situation_date" : "20221003",
"feedback_date" : "202210061222",
"anomaly_packages_number" : "",
"comments" : "",
"new_appointment_date" : "",
"field33" : "",
"field34" : "",
"field35" : "",
"assigned" : "",
"field37" : "",
"agreed_tax" : "",
"field39" : "",
"field40" : "20221006123304-3f621cf7-3",
"field41" : "",
"field42" : "",
"field43" : "",
"field44" : "212059",
"doc_url" : "",
"field46" : "",
"field47" : "",
"field48" : ""
}, {
"version" : "5",
"type" : "REPORT",
"dp_code" : "DHA592",
"field4" : "83482227299911",
"field5" : "83482227299911",
"platform_name" : "GHESTEM LA CHAPELLE",
"field7" : "01143200",
"field8" : "72801371220938",
"field9" : "72801371220938",
"carrier_name" : "",
"shipper_name" : "",
"field12" : "",
"consignee_name" : "",
"consignee_code" : "",
"consignee_address" : "",
"consignee_city" : "",
"field17" : "",
"ldc_number" : "",
"ldc_date" : "",
"shipment_number" : "2022115144",
"shipment_code" : "2022115144/SH",
"field22" : "",
"field23" : "",
"field24" : "",
"field25" : "",
"situation_code" : "POD",
"justification_code" : "CFM",
"situation_date" : "20221003",
"feedback_date" : "202210061208",
"anomaly_packages_number" : "",
"comments" : "",
"new_appointment_date" : "",
"field33" : "",
"field34" : "",
"field35" : "",
"assigned" : "",
"field37" : "",
"agreed_tax" : "",
"field39" : "",
"field40" : "20221006121304-3f61f8b6-3",
"field41" : "",
"field42" : "",
"field43" : "",
"field44" : "212059",
"doc_url" : "",
"field46" : "",
"field47" : "",
"field48" : "S"
}, {
"version" : "5",
"type" : "REPORT",
"dp_code" : "DHA592",
"field4" : "83482227299911",
"field5" : "83482227299911",
"platform_name" : "GHESTEM LA CHAPELLE",
"field7" : "01143200",
"field8" : "72801371220938",
"field9" : "72801371220938",
"carrier_name" : "",
"shipper_name" : "",
"field12" : "",
"consignee_name" : "",
"consignee_code" : "",
"consignee_address" : "",
"consignee_city" : "",
"field17" : "",
"ldc_number" : "",
"ldc_date" : "",
"shipment_number" : "2022115144",
"shipment_code" : "2022115144/SH",
"field22" : "",
"field23" : "",
"field24" : "",
"field25" : "",
"situation_code" : "AAR",
"justification_code" : "CFM",
"situation_date" : "20221003",
"feedback_date" : "202210061208",
"anomaly_packages_number" : "",
"comments" : "",
"new_appointment_date" : "",
"field33" : "",
"field34" : "",
"field35" : "",
"assigned" : "",
"field37" : "",
"agreed_tax" : "",
"field39" : "",
"field40" : "20221006121304-3f61f8b6-3",
"field41" : "",
"field42" : "",
"field43" : "",
"field44" : "212059",
"doc_url" : "",
"field46" : "",
"field47" : "",
"field48" : "S"
} ] My need is to grab only one element of json file based on "situation_code" in a priority order. To explain me well, situation code can have the following possible values: POD (search priority 1) LIV (search priority 2) AAR (search priority 3) TTR (search priority 4) The logic behind should be the following: Grab only one entire element by evaluating at first POD as value, if found grab it, if not found then evaluate LIV and grab it in case, if not found then evaluate AAR and grab it, and so on until you found a possible value. Many thanks for any hints
... View more
Labels:
- Labels:
-
Apache NiFi
- « Previous
-
- 1
- 2
- Next »