Member since
05-20-2022
66
Posts
6
Kudos Received
6
Solutions
My Accepted Solutions
Title | Views | Posted |
---|---|---|
1222 | 07-17-2023 11:25 PM | |
1211 | 04-17-2023 02:29 PM | |
5801 | 02-15-2023 08:47 PM | |
935 | 02-08-2023 06:02 PM | |
4595 | 10-17-2022 11:48 AM |
10-12-2022
03:37 PM
1 Kudo
Try this... [
{
"operation": "cardinality",
"spec": {
"*": {
"*": {
"Product": "MANY"
}
}
}
}
]
... View more
10-06-2022
11:42 AM
Brilliant! That does the trick. Thanks!
... View more
10-06-2022
08:20 AM
Are you suggesting it is possible to perform a complete swap of the flow file content using a ReplaceText processor? For example: If the flow file = "ababababac" Can I use a single ReplaceText to create <xml>ababababac</xml>? From everything I've read in the docs you can't use the Expression Language to get at the whole of the flow file content, e.g. ${flowFile} So instead what I do is use 2 ReplaceText processors successively; the first one performs a "Prepend", and the second one performs an "Append". This technique just bookends (brackets) the flow file content. For example: Base64Encode ReplaceText (prepend) ReplaceText(append) ababababac ==> <xml>ababababac ==> <xml>ababababac</xml> But, if you know of a way to do this with a single processor then I'd love to hear your suggestions. Thanks!
... View more
10-04-2022
04:49 PM
How can I use the output of the Base64EncodeContent (or the Base64Encode function) as input for an XML template, where the flow file content (not an attribute) is the XML with the encoded value included? There doesn't seem to be a NiFi reader that reads the encoded flow file content, so I'm not sure how best to use this processor aside from using a couple of ReplaceText processors to bracket XML substrings around it. I appreciate any input. Thanks for reading. example: Initial Flow File: "The quick brown fox jumped over the lazy dog" Encoded Flow File: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2c= <?xml version="1.0" encoding="UTF-8" ?>
<a xmlns="some/name/space/goes/here">
<b>This is a template</b>
<c>ENCODED DATA GOES HERE</c>
</a>
... View more
Labels:
- Labels:
-
Apache NiFi
09-27-2022
12:30 PM
When converting XML to JSON, and using an Avro schema to specify what that JSON should look like, how does NiFi handle instances of a single XML child element versus multiple child elements when doing the conversion? For example: Given the following XML: <employees>
<employee>
<name>John Doe</name>
<addresses>
<work>
<number>123</number>
<street>5th Avenue</street>
<city>New York</city>
<state>NY</state>
<zip>10020></zip>
</work>
<home>
<number>456</number>
<street>Elm Street</street>
<city>Queens</city>
<state>NY</state>
<zip>10023></zip>
</home>
</addresses>
</employee>
<employee>
<name>Bob Smith</name>
<addresses>
<home>
<number>987</number>
<street>Oak Road</street>
<city>Staten Island</city>
<state>NY</state>
<zip>10030></zip>
</home>
</addresses>
</employee>
</employees> The first employee, John Doe, has two address which NiFi converts to a JSON array, good to go. However, the second employee, Bob Smith, works from home so he has only one address. However, the "address" field is an array so Bob Smith's addresses needs to be a one element array. By using an avro schema during the write operation the, the ConvertRecord processor throws an error when it encounters a record like Bob Smith rather than creating it as a single value array. How do I configure NiFi to use the schema to define the JSON output so I can ensure Bob Smith's addresses are captured as single value arrays? Thanks for the support!
... View more
Labels:
- Labels:
-
Apache NiFi
09-27-2022
11:26 AM
Brilliant! Exactly what I was looking for. Although it seems a little peculiar to me that we need to rely on a Jolt transform for this operation and not the UpdateRecord processor. Particularly since NiFi makes it a point to discuss Arrays and Maps in the documentation. Thanks for the Jolt transform because I spent a lot of time trying to get the Jolt transform to work and couldn't quite figure it out. Now I see what I was doing wrong.
... View more
09-26-2022
07:26 PM
If I have a flow file with the following JSON how can I 1) Evaluate "addresses" to determine if it is of type Array or type Map 2) If type Map then convert "addresses" into an array using native NiFi capabilities (i.e. no string parsing)? {
"name": "John Doe",
"addresses": {
"work": {
"number": "123",
"street": "5th Avenue",
"city": "New York",
"state": "NY",
"zip": "10020"
}
}
} This is what I need it to look like: {
"name": "John Doe",
"addresses": [{
"work": {
"number": "123",
"street": "5th Avenue",
"city": "New York",
"state": "NY",
"zip": "10020"
}
}]
} I appreciate the input and support! Thank you.
... View more
Labels:
- Labels:
-
Apache NiFi
09-21-2022
09:44 PM
Does NiFi offer a way to generate XSD schemas from an XML similar to the way it generates Avro schemas from JSON?
... View more
Labels:
- Labels:
-
Apache NiFi
09-19-2022
10:03 PM
Thanks @SAMSAL and @araujo for the responses. The RouteOnAttribute is what I am using presently but it gets unwieldily after just a couple of route options. Looks like I'm just gonna need to build a custom validator using the ExecuteScript processor. Hopefully that scales.
... View more