• 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: pulling data from 2 tables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pulling data from 2 tables


  • Subject: Re: pulling data from 2 tables
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 16 Feb 2006 18:11:12 -0800

Hi Jim,

On Feb 16, 2006, at 5:36 PM, Jim Wong wrote:

oh... i have an entity COMPANY which has an attribute customerIndustryID which stores for exception numbers like 7, 10, 11 etc. this numbers can be found in another entity INDUSTRY which has a corresponding attribute like F&B (7), Banking (10), Manufacturing (11) etc.

Now where is that Jerry Walker?  He loves questions like this...

OK, I will do a short version and Jerry can do the epic later.

A fundamental rule of thumb with WO (and EOF in particular) is "If you are thinking about keys, you are doing it wrong". Let EOF worry about the numbers. You worry about objects.

What does your model look like? You should have a Company entity related (the a to-one relationship) to an Industry entity based on company.customer_industry_id = industry.industry_id or whatever you called the columns in the database. If not, you should go back and read the tutorials and documention on EOModeler and consider them in the context of what you are trying to do.


How do I display all the information of a COMPANY in a form and when it display customerIndustryID, i want it to display the name like F&B, Banking, Manufacturing instead of the numbers stored in the COMPANY?

First off, customerIndustryID should not be a class attribute so you should not even have the option of showing it. :-) Exposed keys Bad. Marking the primary and foreign keys as not class properties (click the diamond to the left in EOModeler) can help prevent many problems when you are starting out.

Now, if your model is correct, all you need to do is to call customer ().industry().name() to get F&B, Banking etc. For use in WO page, add a WOString and bind it to customer.industry.name. Yes, it really is that simple when you are using WO!

Chuck

--
Coming in 2006 - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro


Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects




_______________________________________________ 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: pulling data from 2 tables
      • From: "Jerry W. Walker" <email@hidden>
References: 
 >pulling data from 2 tables (From: Jim Wong <email@hidden>)

  • Prev by Date: objectMatchingKeyAndValue
  • Next by Date: Re: objectMatchingKeyAndValue
  • Previous by thread: pulling data from 2 tables
  • Next by thread: Re: pulling data from 2 tables
  • Index(es):
    • Date
    • Thread