Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Select a subset of data using NiFi QueryRecord

avatar
Expert Contributor

Given the below contrived JSON dataset, how do I use the QueryRecord processor in conjunction with the RPATH function to select just those students that are Freshman?

 

I've tried something along the lines of:

SELECT RPATH(Students, '/ForGrade/FGStudents')

FROM FLOWFILE

WHERE RPATH(Students, '/ForGrade/FGStudents/Year') == 'Freshman'

 

I appreciate the help.

 

 

 

[
    {
        "Course": {
            "CourseName": "Physics 101",
            "Instructor": {
                "Name": "Bob Smith",
                "Status": "Adjunct"
            },
            "LectureDays": "MTWF",
            "LectureTime": "9:00",
            "LectureLength": "60min",
            "LabDays": "Th",
            "LabTime": "15:00",
            "LabLength": "90min"
        },
        "Students": {
            "ForGrade": {
                "FGStudents": [
                    {
                        "FirstName": "Jane",
                        "LastName": "Doe",
                        "Year": "Sophmore"
                    },
                    {
                        "FirstName": "Jonny",
                        "LastName": "Football",
                        "Year": "Senior5"
                    },
                    {
                        "FirstName": "Bill",
                        "LastName": "Gates",
                        "Year": "Freshman"
                    }
                ]
            },
            "NoGrade": {
                "NGStudents": [
                    {
                        "FirstName": "Bob",
                        "LastName": "Johnson",
                        "Year": "N/A"
                    },
                    {
                        "FirstName": "Elizabeth",
                        "LastName": "Jones",
                        "Year": "Freshman"
                    }
                ]
            }
        }
    }
]

 

 

 

0 REPLIES 0