2012-04-30 59 views
1

我正在開發一個顯示日曆活動的iPad應用程序,並且我有2個與此活動相關的MBO。我能夠通過查詢+連接獲得結果集。但是我無法使用testcriteria語句獲得「where」查詢。 查詢是OK,直到我添加testcriteria行。 這是代碼:Sybase SUPQuery testcriteria問題[iOS]

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]]); 

} 

中的「d」,在第5行是一個的NSDate變量。

這是錯誤消息:

Terminating app due to uncaught exception 'SUPPersistenceException', reason: 'unexpected null value for '"b"' 
+0

任何想法????????? – javiazo

回答

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

SUP不知道有些NSObjects,你需要轉換或換到SUP對象。試試這個:)