1

I'm developing an iPad app that shows activities in a calendar and I have 2 related MBOs with this activities. I am able to get the result set via query + join. But I am not able to get a "where" query using a testcriteria sentence. The query is OK until I add the testcriteria line. This is the code:

SUPQuery *oneActivitiesQuery = [SUPQuery getInstance];
[oneActivitiesQuery select:@"c.DATE_FROM, d.DESCRIPTION"];
[oneActivitiesQuery from:@"GetCalendar" :@"c"];
[oneActivitiesQuery join:@"GetActivityDetail" :@"d" :@"d.GUID" :@"c.GUID"];
oneActivitiesQuery.testCriteria = [SUPAttributeTest match:@"c.DATE_FROM" :d];
SUPQueryResultSet* calendarResultSet = [MBOCRM_MOBILE_MBOCRM_MOBILEDB executeQuery:oneActivitiesQuery ];


if (calendarResultSet  == nil) {
    MBOLog(@"executeQuery failed");
    return;
}


for (SUPDataValueList* result in calendarResultSet ){

    MBOLog(@"Date --> %@", [[SUPDataValue getNullableDate:[result item:0]] description]);  
    MBOLog(@"Description --> %@", [SUPDataValue getNullableString:[result item:1]]);

}

The "d" in th 5th line is a NSDate variable.

And this is the error message:

Terminating app due to uncaught exception 'SUPPersistenceException', reason: 'unexpected null value for '"b"'
javiazo
  • 1,892
  • 4
  • 26
  • 41

1 Answers1

0
SUPDateValue *thedatevalue = [SUPDateValue newInstance];
[thedatevalue setValue:d];
oneActivitiesQuery.testCriteria = [SUPAttributeTest match:@"c.DATE_FROM" : thedatevalue];

SUP doesn't know some NSObjects, you need convert or wrap to SUP object. Try this :)

iTux
  • 1,946
  • 1
  • 16
  • 20