Re: getting the lastObject value from an NSArray - How to has escaped me
Re: getting the lastObject value from an NSArray - How to has escaped me
- Subject: Re: getting the lastObject value from an NSArray - How to has escaped me
- From: George Domurot <email@hidden>
- Date: Wed, 29 Oct 2003 17:11:47 -0500
This should work for you:
public int countForJobPictures(){
try {
NSArray results =
EOUtilities.rawRowsForSQL(editingContext(),"BTT", "SELECT COUNT(*) FROM
TB_JOB_PICTURE");
NSDictionary countDictionary =
(NSDictionary)results.objectAtIndex(0);
return
((Long)countDictionary.allValues().objectAtIndex(0)).intValue();
} catch (Exception exception) {
}
return 0;
}
On Wednesday, October 29, 2003, at 12:15 PM,
email@hidden wrote:
> [demime could not interpret encoding binary - treating as plain text]
> Integer count = (Integer) pictureList.lastObject();
>
> I think?
>
> On Wed, 29 Oct 2003 07:25:43 +0000 "Jonathan Fleming" wrote:
>
>> I know this should be very simple but for the life of me I can figure
>> what I
>> should be doing.
>> I want to get the value form this code please - anyone?
>>
>>
>> EOEditingContext ec = session().defaultEditingContext();
>> NSArray pictureList = EOUtilities.rawRowsForSQL(ec,
>> "BTT",
>> "SELECT
>> COUNT(*)
>> FROM TB_JOB_PICTURE");
>> /*this statemnet is all wrong*/ int picCount =
>> Integer.parseInt(
>> pictureList.lastObject().toString() );
>> NSLog.out.appendln("===\r countOfPictureList = " +
>> picCount);
>>
>> _________________________________________________________________
>> Tired of 56k? Get a FREE BT Broadband connection
>> http://www.msn.co.uk/specials/btbroadband
>> _______________________________________________
>> webobjects-dev mailing list | email@hidden
>> Help/Unsubscribe/Archives:
>> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
>> Do not post admin requests to the list. They will be ignored.
> _______________________________________________
> webobjects-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.