Member since
12-11-2017
21
Posts
4
Kudos Received
2
Solutions
My Accepted Solutions
| Title | Views | Posted |
|---|---|---|
| 5949 | 12-21-2020 02:44 AM | |
| 2982 | 07-10-2020 08:42 AM |
12-21-2020
02:44 AM
1 Kudo
Hello @Lokeswar The queryRecord processor does exactly what you want. But you need to have your job in a record-oriented approach, using json reader and json writter. Then you don't work with flow-file attribute, but directly with your flow-file content. So, you have your CSV: - use a convertRecord to transform it in record flow-file, using CSVreader as reader, and JSONTreeWriter as out writer as you want JSON - add a queryRecord processor, and your query should look like this: SELECT * FROM FLOWFILE WHERE resourceState='INSTALLED' OR resourceState='RETIRED' warning: don't use double quote for values, just simple quote After this, you will have a condition at the output of the queryrecord that you can plugto your next processor.
... View more
12-14-2020
07:23 AM
Hello @justenji Thanks for the detailed explanation, this is also what I have tested on my side and in my opinion this does the job being "record oriented" 🙂 Have a nice day
... View more
12-09-2020
02:12 AM
I need to test this, but actually it seems that the queryRecord is exactly why I need. It is possible to build some complex conditions using SQL-like language on the record content and then perform some routing based on that
... View more
12-08-2020
08:24 AM
Hello @justenji Thanks anyway to have taken some time to look after my issue. For now, the only solution I have found is a groovy script. Stéphane
... View more
12-07-2020
08:37 AM
Hello @justenji Thanks for you reply. The problem here is that you are working with attributes and expression language, which would mean to have one flowfile per json object. I'm trying to have a record-oriented flow-file, which means that everything happens with recordpath and / or Jolt transformations. My flow file have multiple JSON records and as such attributes would take multiple values. And I don't want to split my records, this is really resource consuming. Best regards, Stéphane
... View more
11-30-2020
08:37 AM
Hello all, I'd like to use the updateRecord processor to create some fields in my JSON. But I'd like to use some conditions to do that. In the recordpath documentation, I can see that there is a "filter" capability, which works like this: /field[filter]/path, but as far as I can see it's not possible to have multiple conditions in this filter. I'd like to do something like: if (field1 == A or field1 == B) {
field2 = C
} else if (field1 == D and field1 != E) {
field2 = G
} The example is silly but this is to give you the idea. By the way, except using a script, I don't know how to do that, except may be extracting the fields, put it as attribute and play with expression language but this would mean working with single-record flows and I don't want to do that. Any idea? Thanks for your suggestions Stéphane
... View more
Labels:
- Labels:
-
Apache NiFi
07-10-2020
08:42 AM
2 Kudos
Answer to myself: I solved the problem by converting this boolean to string using Jolt: {
"operation": "modify-overwrite-beta",
"spec": {
"status": {
"*": {
"isCurrentStatus": "=toString"
}
}
}
}
... View more
07-02-2020
07:37 AM
Hello, I have a piece of JSON on which I want to apply an updateRecord processor using some filter capabilities. My JSON looks like this: "status": [
{
"code": "InProgress",
"isCurrentStatus": false,
"startDateTime": "2020-03-05T20:45:00Z"
},
{
"code": "Pending",
"isCurrentStatus": true,
"startDateTime": "2020-03-05T21:20:00Z"
}
], And my RecordPath expression is the following: /status[0..-1][./isCurrentStatus = true]/code This expression doesn't work and I have an error in my logs file stating about incorrect syntax: Unexpected token ']' at line 1 If I put the following syntax: /status[0..-1][./isCurrentStatus = "true"]/code it doesn't give anymore error, but of course the filter doesn't work. So, I have the feeling that recordPath filter doesn't support the use of boolean values. My Nifi is Nifi 1.9.0 coming with HDF 3.4. Any idea? Thanks a lot, Stéphane
... View more
Labels: