Member since
07-29-2020
566
Posts
312
Kudos Received
170
Solutions
My Accepted Solutions
Title | Views | Posted |
---|---|---|
101 | 12-11-2024 06:28 AM | |
66 | 12-10-2024 05:50 AM | |
167 | 11-28-2024 06:07 AM | |
228 | 11-27-2024 11:12 AM | |
121 | 11-25-2024 09:21 AM |
09-12-2022
01:05 PM
Hi , Not sure if there is better way, but in my case I was able to get the result using two QueryRecord Processors: 1- Query everything with new field (lets call max_Date) to assign the max between "situation_date" and "new_appointment_date" on each record, in this case the query will be like this: SELECT *, case when situation_date> new_appointment_date then situation_date else new_appointment_date end maxDate
FROM FLOWFILE
2- Next QueryRecord will basically capture the max based on the max_date above from each flowfile records, as follows: SELECT *
FROM FLOWFILE
WHERE max_date = (
SELECT MAX(max_date) from FLOWFILE
) Not sure if this can be done in more efficient way, If anyone can think of better way please advise, otherwise if this works for you please accept solution. Thanks
... View more
09-12-2022
09:04 AM
Hi, I'm not sure if you can use Regex in jolt transformation, but you can use wildcard (*) instead. Keep in mind even with Regex you still need to find the common denominator for each attribute to be able to match, so wildcard should suffice. To use the wildcard you can apply something like this to your spec: [
{
"operation": "shift",
"spec": {
"my_id": "my_id",
"my*company*sa": "my_company_sa",
"*RH": "my_company_rh"
}
}
] Hope that helps, if it does please accept solution. Thanks
... View more
09-12-2022
08:49 AM
Hi, To help you I think we need to understand your question better, so you have a json input like you specified above, from what I understand there are two parts you are trying to solve: 1- You need to process this json if it meets certain condition, in this case the condition is if the Json attribute "dataSourceName" is equal to "Standard CPU Utilization Network Cisco". 2- If the json meets the condition above then you want to apply Json Jolt Transformation to produce the output you specified, is this correct? To answer the first part, I'm not sure if you can have conditional json jolt so you can do the first and the second part in one processor. I think what you need to do is use EvaluateJsonPath processor to extract the value that you need -dataSourceName- into a flow file attribute then use RouteOnAttribute to check the value so that if meets the condition (="Standard CPU Utilization Network Cisco" ) the match relationship will direct the flow file to the Jolt transformation processor to apply needed transformation , otherwise the flowfile will be dropped or direct to unmatched relationship for farther processing. For the second part, its not clear if you need the exact output you specified no matter what the other values in the input json are , which in this case you can use the ReplaceText processor just to replace the whole input json with the expected out, Or you actually need json jolt transformation to capture different values for each json input which in this case its not clear how you are selecting your values, for example on what basis you decided that the value of "Datapoints" is "MemoryFree", also how the attribute "Datas" has the value of "Values[3]". So you need to clarify that better so we can help you with creating the proper jolt spec. Hope that helps. Thanks
... View more
09-12-2022
07:38 AM
Hi, I dont think you need the asterisk "*" in the spec, since you need it on the first level and you dont need to reference any other fields. Just have your spec as follows: [
{
"operation": "modify-default-beta",
"spec": {
"target.organisation": "${target.organisation}"
}
}
]
... View more
09-09-2022
11:01 AM
1 Kudo
Hi, Not sure how you get the URL but if its hard coded in the InvokeHttp Remote URL property , then you can use expression language to set up your parameters as follows: ${literal('https://api.aa/reports/api/order_report/?format=json&dateFrom=#DATEFROM&dateTo=#DATETO'):
replace('#DATEFROM',${now():format('yyyy-MM-dd')}):
replace('#DATETO',${now():toNumber():minus(432000000):format("yyyy-MM-dd")})} Notice: - you can set the date format as desired, in my case I assumed that its in yyyy-MM-dd format. - To subtract 5 days from the current date you have to convert the date to number , then subtract 5 days in milliseconds (1day = 86,400,000 mls ). Hope that helps, if it does please accept solution. Thanks
... View more
09-09-2022
10:38 AM
2 Kudos
Hi , Do you usually have the ID sorrounded with the same phrases all the time? like this: /organisations/ID/detailedLaborcosts If that is the case you can use the following regex in the extract text processor: /organisations/([0-9a-z]+)/detailedLaborcosts Hope that helps.
... View more
09-06-2022
06:55 AM
Hi, you can use the flowfile size attribute "fileSize" to check for the size. for example if you want to process flowfile from S3 that has contents you can create new property in the RouteOnAttribute processor with the following EL: ${fileSize:gt(0)} If you find this helpful, please accept solution. Thanks
... View more
09-03-2022
01:44 PM
Hi , where is the key,value pair are stored? Are they stored as a flowfile attribute or in the input json? there are processors like RouteOnAttribute in case they are stored as attributes where you can create your condition as dynamic property and provide the logical expression there. If the key\value pair is part of the json you can use Extract Text to Extract the key\value pair as an attribute then use RouteOnAttribute or you can try to use RouteOnContent if that will work? If you find this helpful, please accept solution. Thanks Samer
... View more
09-01-2022
12:05 PM
Hi , you can use QueryRecord Processor. For more information please see: https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.12.1/org.apache.nifi.processors.standard.QueryRecord/additionalDetails.html If you find this helpful please accept solution. Thanks
... View more
08-31-2022
03:02 PM
1 Kudo
Hi , Not sure if this is possible with out of the box processor. I can think of ReplaceText first to replace different delimiters like (-) or white-space (\s) to common delimiter like (,) however if there is a white space before or after other delimiters like (-) or (,) its not going to work. Another option is to use ExecuteScript processor where you try to read each line (after the header) from the flowfile content and then use string split function and try it with different delimiter, once you get two array elements you construct your new string with the new column header and delimiter and transfer to the success relationship.
... View more