Member since
03-29-2023
52
Posts
32
Kudos Received
3
Solutions
My Accepted Solutions
Title | Views | Posted |
---|---|---|
1085 | 04-05-2024 12:26 PM | |
1379 | 03-05-2024 10:53 AM | |
10434 | 04-03-2023 12:57 AM |
05-06-2024
01:42 PM
1 Kudo
Thank you very much, @SAMSAL. I really appreciate your time and effort. My input format has changed. I will adjust the JOLT accordingly if it does not work or encounter any issues, I will ask one final question. Otherwise, I will mark your last reply as the solution.
... View more
05-06-2024
05:12 AM
Hi @SAMSAL , Am I missing something on the JOLT? Not getting output as expected. (DEFECT_ROOT_CUASE) columns is missing from output. ===========================================
--Input
===========================================
{
"id": "33414",
"fields": {
"customfield_10161": [
{
"value": "Backend"
},
{
"value": "Frontend"
}
]
}
}
===========================================
--JOLT Spec
===========================================
[
// Entries (where "flat" "data" when there is an array) (now starts at 8)
{
"operation": "shift",
"spec": {
"id": "INTEGRATION_ID",
"*": {
"*_*": {
"@": "&(1,1)",
"0": {
"#true": "isArray"
}
}
}
}
},
//If the input is not an array, assign default isArray=false
{
"operation": "default",
"spec": {
"isArray": "false"
}
},
//Depending on with isArray true for false
//Transpose values into DEFECT_ROOT_CAUSE_List_Array
{
"operation": "shift",
"spec": {
"customfield": null,
"*": "&",
"isArray": {
"true": {
"@(2,customfield)": {
"*": {
"value": {
"@": "DEFECT_ROOT_CAUSE_LIST[]"
}
}
}
},
"false": {
"@(2,customfield)": "DEFECT_ROOT_CAUSE_LIST[]"
}
}
}
},
// Finally, get the last element of the array
{
"operation": "modify-overwrite-beta",
"spec": {
"DEFECT_ROOT_CAUSE": "=lastElement(@(1,DIRECT_ROOT_CAUSE_LIST))"
}
}
]
===========================================
--Output
===========================================
{
"INTEGRATION_ID" : "33414",
"DEFECT_ROOT_CAUSE_LIST" : [ "Backend", "Frontend" ]
}
... View more
04-23-2024
09:57 AM
Hi @SAMSAL , My requirement is very simple. I anticipate receiving the single records in the output. That's DEFECT_ROOT_CAUSE, regardless of whether my input is a list or sinlge records. (The primary source is JIRA; a bug ticket has been generated there, indicating that the issue may be in the front end or back end. However, occasionally a reporter will tag the back end before the front end, leading to the creation of a list. ) > my input is almost 200 line however I am only putting the required column only. I have posted two image one is for list records and one is single records with same column (only records is getting changes that's it.
... View more
04-23-2024
03:58 AM
1 Kudo
This is how I am currently handling the records. All I'm doing is flagging the rows and sending them to the appropriate process. However, suppose in the future that a new field or an existing one begins to capture List data; in that case, I would need to modify the flow and add more conditions. I just needed a single field, therefore let's say that if it captures the list, it will show up as the last record or as a single record.
... View more
04-22-2024
11:33 PM
1 Kudo
This customfield_ will not change because it is static. I'm handling this aspect in NiFi right now, however I get into trouble when I acquire more fields as lists and have to change the NIFI Flow.
... View more
04-21-2024
10:17 PM
Hi @SAMSAL, Thank you for the reply. There are still no columns showing in the non-list scenario.
... View more
04-21-2024
01:24 PM
Hello, Can you assist me in retrieving the values stored in the "customfield_10161" field from JSON input? My expectation is to consistently receive the values and name it "DEFECT_ROOT_CAUSE" , whether they are stored as a list or as a single value." How to write JOLT which will handle the both the case. let say If I will get list then extract last element of it, if not list then record as it is.? Extracting List: (works fine when input is list) when input is not list: then DEFECT_ROOT_CAUSE column is missing My expectation to get the records in DEFECT_ROOT_CAUSE columns whether its list or not.
... View more
Labels:
- Labels:
-
Apache NiFi
04-06-2024
06:54 PM
1 Kudo
Hi @enam , Did above solution help you?
... View more
04-05-2024
12:26 PM
1 Kudo
Hi @Nicanor , Let's take a below example: Json Input: [
{
"cloud_base": [
"3500",
"15000"
],
"cloudType": [
"Stratocumulus",
"Altocumulus"
]
}
] Jolt Spec: [
{
"operation": "shift",
"spec": {
"*": {
"cloud_base": {
"*": {
"*": {
"@1": "cloud_base_&"
}
}
},
"cloudType": {
"*": {
"*": {
"@1": "cloudType_&"
}
}
}
}
}
}
] Output: {
"cloud_base_3500" : "3500",
"cloud_base_15000" : "15000",
"cloudType_Stratocumulus" : "Stratocumulus",
"cloudType_Altocumulus" : "Altocumulus"
} "Accept as Solution" if its work for you.
... View more
04-05-2024
11:24 AM
1 Kudo
@Nicanor , Could you please provide the JSON input also?
... View more