• 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: DirectAction to a Primary Key
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DirectAction to a Primary Key


  • Subject: Re: DirectAction to a Primary Key
  • From: Dev WO <email@hidden>
  • Date: Tue, 11 Oct 2005 18:01:32 +0200

Hi Will,
thank you for your sample, it works as expected:)
Just one more thing (no I'm not going to annonce anything;)), if I wanted to check for a valid newsID, like making sure there's an item with the specific newsID, should I test it before the
EOEnterpriseObject newsItem = EOUtilities.objectWithPrimaryKey (EOSharedEditingContext.defaultSharedEditingContext(), "News", keyDict);
or should I check if newsItem is null? I think the later won't work as EOUtilities will return an error before the following lines are executed.


So assuming I'm going for the validation before EOUtilities, I'm not very familiar with the try/catch stuff, but is it what I should do?

Thanks a lot again.

Xavier


If I understood you correctly, you would like to have a direct action to a news detail page displaying the news for ID "x".

In your detail component add a method

public void setNewsItemForID(Integer id) {
NSMutableDictionary keyDict = new NSMutableDictionary();
keyDict.setObjectForKey(id, "newsID"); // let's assume your news item id field is called "newsID"
EOEnterpriseObject newsItem = EOUtilities.objectWithPrimaryKey (EOSharedEditingContext.defaultSharedEditingContext(), "News", keyDict);
// ... and so on
}


Hope this helps.

Cheers,
Will

On 11.10.2005, at 15:59, Dev WO wrote:


Hi list,
I'm actually working on a small "news headline" application.
I have a component with the last x items displayed in list view, then clicking on one displays this one with all its details.


I need some external pages to be able to provide a link to a specific item and provide my component with the detailed view directly.

I think I'll be able to change the conditional value in the direct action using
nextpage.setConditionnal(new Boolean(true))


but I don't know how to get the correct item using it's primary key...
After some searching, I have found the following method
EOUtilities.primaryKeyForObject
but I couldn't make this DA works:(


I know it is something trivial I should know about, but I don't;)

So if anyone has a pointer or even better a short sample, It would help me a lot:)

Thanks

Xavier
_______________________________________________
WebObjects-dev mailing list
email@hidden
http://www.omnigroup.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/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: DirectAction to a Primary Key
      • From: David LeBer <email@hidden>
References: 
 >DirectAction to a Primary Key (From: Dev WO <email@hidden>)

  • Prev by Date: Re: New license?
  • Next by Date: Re: DirectAction to a Primary Key
  • Previous by thread: Re: DirectAction to a Primary Key
  • Next by thread: Re: DirectAction to a Primary Key
  • Index(es):
    • Date
    • Thread