• 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: Need To Get PrimaryKey ID
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need To Get PrimaryKey ID


  • Subject: Re: Need To Get PrimaryKey ID
  • From: Jonathan Rochkind <email@hidden>
  • Date: Mon, 24 Mar 2003 11:51:11 -0600

That code looks good to me. What problem are you having?

Here's another way to get the pk though:
http://wodev.spearway.com/cgi-bin/WebObjects/WODev.woa/wa/Main?wikiPage=singleIntegerPrimaryKeyForObject

--Jonathan

At 07:44 PM 3/21/2003 +0000, Jonathan Fleming wrote:

If there is a better way to do this then please inform me... I'm trying to get the primary key ID so that I can use this as an identifying feature in a directory name (as well as making the directory unique) that I will create for a client's tbJobPicture object.
Below is the Method i am trying to use and I'm getting null value in the WOString element that i'm testing it with in the build for every item in my fetched List...
making the directory is not a problem but trying to get the ID in as part of the name such as - Haydon_334.dir, Jones_8.dir or Haydon_4545.dir - is proving difficult.
I need to be able to stucture the directories like this so that they can be easily identified if needs be, as if they were EO's in the EOModel.
What am I doing wrong to obtain the Object's ID.


Here's the code:

tbJobPicture has PK tbJobPicture & FK tbJobID
tbJob has PK tbJobID & FK tbClientID
----------------------------------------------

   protected TbJob tbJob;
   protected TbJobPicture tbJobPicture;
   protected String sTb_JobID;
   protected String sTb_ClientID;

public Integer tbClientID() {
EOEnterpriseObject tbJobPicture = (EOEnterpriseObject) valueForKeyPath("tbJob");
NSDictionary primaryKey = EOUtilities.primaryKeyForObject(tbJobPicture.editingContext(), tbJob);
NSLog.out.appendln("Dictionary to get tbClientID: " + primaryKey);
String strID = new String();
strID = String.valueOf( (Integer) primaryKey.valueForKey("tbClientID") );
setTb_ClientID(strID);


       return (Integer) primaryKey.valueForKey("tbClientID");
   }


public String getTb_ClientID() { return sTb_ClientID; }

public void setTb_ClientID(String value) {
NSLog.out.appendln( "\nThe Client ID For " + sClientLastName() + " is: " + getTb_ClientID() );
sTb_ClientID = value;
}


Desperatly seeking help with this...
   Many thanks for any help offered

   Regards
   Jonathan




_________________________________________________________________ Express yourself with cool emoticons http://messenger.msn.co.uk

_______________________________________________
WebObjects-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
_______________________________________________
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.

References: 
 >Need To Get PrimaryKey ID (From: "Jonathan Fleming" <email@hidden>)

  • Prev by Date: Re: Cocoa EOF Applications & December 2002 Dev Tools
  • Next by Date: EOWidgetController
  • Previous by thread: Re: Need To Get PrimaryKey ID
  • Next by thread: Which Version of Documentation should I use
  • Index(es):
    • Date
    • Thread