Retrieve the additional subject field from the database

General information about Neurotechnology and its software

Retrieve the additional subject field from the database

Postby torontoxx » Nov 17, 2017 08:21

Hi all!
I"m using Neurotechnology Biometric SDK 10.0 (trial) and SQLite as the database engine. I need to store the additional fields (like age) in the database. In order to enable this custom data support i specify a CustomDataSchema property in NBiometricClient:
Code: Select all
NBiometricClient biometricClient;
biometricClient.SetCustomDataSchema(NBiographicDataSchema::Parse(N_T("(Age int)")));

Where: "Age" - the column name, "int" - the additional field type.
To enroll subject with the additional field with name "Age" to the database i"m using a SetProperty method in NSubject:
Code: Select all
   NSubject subject = <...create subject...>
   NLAttributes attributes = <...get age value...>
   subject.SetProperty(N_T("Age"), attributes.GetAge());

All works fine, the subjects with the additional field with name "Age" are enrolled to the database. But how can i retrieve this additional subject field from the database? I tried the next approach (but it does not work):
Code: Select all
NArrayWrapper<NSubject> list = biometricClient.List();

for (NArrayWrapper<NSubject>::iterator it = list.begin(); it != list.end(); it++)
{
   if (it->GetProperties().Contains(N_T("Age")))
   {
      NInt age = it->GetProperty<NInt>(N_T("Age"));
      cout << "      Age: " << age << endl;
   }
}

But this approach does not work: NSubject GetProperties method return no any age property.
My question is: how can i retrieve the additional subject field (like age) from the database?
Thanks a lot!
torontoxx
 
Posts: 3
Joined: Nov 17, 2017 08:04

Re: Retrieve the additional subject field from the database

Postby MartynasV » Nov 20, 2017 10:26

Hello torontoxx,

"biometricClient.List();" only returns subject's ids that are in database(no other data).

You need to perform Get() method to retreive additional subject's data:
Code: Select all
                  NSubject subject = new NSubject();
                  subject.Id = "UniqueSubjectId";
                  status = biometricClient.Get(subject);
                  // Retrieve custom properties, template
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 259
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania

Re: Retrieve the additional subject field from the database

Postby torontoxx » Nov 20, 2017 11:44

MartynasV wrote:Hello torontoxx,

"biometricClient.List();" only returns subject"s ids that are in database(no other data).

You need to perform Get() method to retreive additional subject"s data:

Hello MartynasV, many many thanks!
Does it mean that every time a Get() method is called, a SELECT query (like: "select * from database where SubjectId=...") is made to the database?
torontoxx
 
Posts: 3
Joined: Nov 17, 2017 08:04

Re: Retrieve the additional subject field from the database

Postby MartynasV » Nov 20, 2017 14:31

torontoxx wrote:Does it mean that every time a Get() method is called, a SELECT query (like: "select * from database where SubjectId=...") is made to the database?

Yes.
Martynas V
Neurotechnology
MartynasV
Neurotechnology
 
Posts: 259
Joined: Feb 27, 2015 11:24
Location: Vilnius, Lithuania

Re: Retrieve the additional subject field from the database

Postby torontoxx » Nov 20, 2017 15:51

MartynasV wrote:
torontoxx wrote:Does it mean that every time a Get() method is called, a SELECT query (like: "select * from database where SubjectId=...") is made to the database?

Yes.

Thanks a lot!
torontoxx
 
Posts: 3
Joined: Nov 17, 2017 08:04


Return to Public

Who is online

Users browsing this forum: No registered users and 2 guests

cron