0

with RealmDB object how to write multiple keys query ? Schema Part:

StudentSchemaNames.student_data = { classID: int, students: Students[], noOfPresence: int, noOfabsence: int, noOfLeft: int } ;

StudentScehmaNames.students = {studentid:int, studentfirstName: string:, studentlastName:string}

I am having an object like;

studentDetails = [{"classID": "001", "students": [Array], "noOfPresence": 30, "noOfabsence": 2, "noOfLeft": 9}];

currently I am fetching details basic on studentId= 001 ;

studentDetails = await RealmDB.get(StudentSchemaNames.student_DATA, studentId="${studentId}" AND 'noOfPresence');

here student ID property is passed with value and noOfPresence only property name and no value in query to be executed.

but I wanted to write query like ; Scenario1: Fetch data basis on student ID with value and NoOfPresence only Property Scenario2: Fetch data basis on students property only with student id value Scenario3: Fetch data basis on class Property only with student id value

help me out to write queries for above scenario with RealmDB. Thank you in advance

Swift
  • 829
  • 2
  • 12
  • 33
  • Are you asking how to write and AND query? So you wand to get back students matching two criteria like classId="${classID}" AND noOfPresence ="${noOfPresence}"? – Jay May 21 '21 at 14:10
  • @Jay, Thank you but as per RealmDB document do we have to pass the values also in query or we can execute query with only properties ? – Swift May 23 '21 at 09:47
  • I don't understand the comment question. How does one *pass the values also in query*? What does *execute query with only properties* refer to? Perhaps you can update the question with code examples of what that means? – Jay May 23 '21 at 12:13

0 Answers0