Member since
04-20-2023
5
Posts
0
Kudos Received
0
Solutions
08-16-2023
03:22 AM
I am trying to convert the following date format -> 8/6/2023 12:46 am to this format -> 2023-08-06 00:46:00. I want to do this using NiFi. I have tried using the UpdateRecod processor for the same and used toDate() and format() for the above conversion. But it didn't give the desired results. How can I achieve this using NiFi?
... View more
Labels:
- Labels:
-
Apache NiFi
05-11-2023
12:43 AM
Hi @cotopaul Thanks for your reply. I am familiar with Jolt (a json to json transformation library). I have been thinking to add the required padding using the funmctions in Jolt and then use the FreeFormTextRecordSetWriter controller service. This service take the name of the key in Json and prepare the file containing only the value. It also keeps the padding added in the previous Jolt Transform. I think using 10 UpdateAttribute will be tough and I have multiple fields that need the required padding/empty spaces. Thank you for your answers!
... View more
04-25-2023
11:12 PM
Hi, I have an input json as below: [
{
"orderId": "1234567890",
"orderName": "Test1",
"orderItems": [
{
"orderItemId": "01",
"orderItemName": "test1-OrderItem1"
},
{
"orderItemId": "02",
"orderItemName": "test1-OrderItem2"
}
]
},
{
"orderId": "12235",
"orderName": "Test2",
"orderItems": [
{
"orderItemId": "01",
"orderItemName": "test2-OrderItem1"
}
]
},
{
"orderId": "12236",
"orderName": "Test3",
"orderItems": [
{
"orderItemId": "01",
"orderItemName": "test3-OrderItem1"
}
]
}
] I want to convert it into text form where we want the order details and then item details for each map in the list. Here is the desired output: 1234567890 Test1
01 test1-OrderItem1
02 test1-OrderItem2
12235 Test2
01 test2-OrderItem1
12236 Test3
01 test3-OrderItem1 This is json to csv conversion, and I am using the ConvertRecord processor and below are the reader and writer configured: 1. Record Reader - JsonTreeReader 2. Record Writer - FreeFormTextRecordSetWriter For the FreeFormTextRecordSetWriter controller service in the text property, I added the key names from the input json like this ${keyName} and got the values but in the next line, I wanted orderItemId from all the maps in the orderItems list. How can I access the values from orderItems list? Thanks in advance!
... View more
Labels:
- Labels:
-
Apache NiFi
04-25-2023
10:37 PM
Hi @cotopaul Thanks for your reply. 1. Yes we have a maximum length of 10 characters every time. The characters will be 10 or less than 10 always. 2. I have an incoming json (a list of maps), and I want each of the maps to be written as: 1. text format. 2. have fixed width length. If there are 6 characters in the value of that field and the maximum length is 10 then the remaining characters should be filled with spaces. 3. There is no delimiter between the fields. 3. I have tried using the ConvertRecord processor to read the JSON and convert it to CSV. But there is a problem with CSV, we have to define a delimiter and I don't need any delimiter. I hope the above information helps you. Is there any way we can prepare the fixed-width length file considering the above points? Thanks.
... View more
04-20-2023
05:47 AM
I have an input JSON file and I want to convert it to a fixed-width length type file. If the length is less than the required length, trailing spaces should be added to the field. Here is the sample Input JSON: [
{
"orderId": "1234567890",
"orderName": "Test1"
},
{
"orderId": "12235",
"orderName": "Test2"
},
{
"orderId": "12236",
"orderName": "Test3"
}
] Here is the desired Output: 1234567890 Test1
12235 Test2
12236 Test3 The condition here is if the length of orderId(in input JSON) is less than 10 then add the required spaces. Can this be done in Nifi? I want to have fixed-width length files. Thanks in advance!
... View more
Labels:
- Labels:
-
Apache NiFi