• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: getting the lastObject value from an NSArray - How to has escaped me
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: "Jonathan Fleming" <email@hidden>
  • Date: Wed, 29 Oct 2003 08:41:07 +0000

From: Art Isbell <email@hidden>
To: email@hidden
Subject: Re: getting the lastObject value from an NSArray - How to has escaped me
Date: Tue, 28 Oct 2003 22:10:12 -1000


On Tuesday, October 28, 2003, at 09:25  PM, 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() );

A raw row is an NSDictionary. So pictureList.lastObject() is an NSDictionary. I don't know what the key in this dictionary is ("Attribute0", "Attribute1", ?). A quick check in the debugger would provide the answer. But in this case, you could punt because there should be only a single entry. Therefore, ((NSDictionary)pictureList.lastObject()).allValues().lastObject() should be the COUNT(*) value as an Integer.

Spot On Art. Thank you very much Jonathan :^)

Aloha,
Art
_______________________________________________
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.

_________________________________________________________________
Find a cheaper internet access deal - choose one to suit you. http://www.msn.co.uk/internetaccess
_______________________________________________
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.

  • Prev by Date: Re: Postgres
  • Next by Date: Re: Postgres
  • Previous by thread: Re: getting the lastObject value from an NSArray - How to has escaped me
  • Next by thread: Re: getting the lastObject value from an NSArray - How to has escaped me
  • Index(es):
    • Date
    • Thread