• 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: How To Check Attribute's Width Programmatically?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How To Check Attribute's Width Programmatically?


  • Subject: Re: How To Check Attribute's Width Programmatically?
  • From: Jonathan Rochkind <email@hidden>
  • Date: Thu, 5 Feb 2004 16:21:10 -0600

At 5:07 PM -0500 2/5/04, email@hidden wrote:
I realize you can set and get attributes of an entity or table programmatically (using either takeValueForKey or valueForKey())

I'm not sure what you mean, but you should distiguish between 'EOEnterpriseObject's and 'EOEntity's. Two different types of objects.


I would however like to retrieve the maximum possible width of the attribute in my program. I ask this because of so : I have an attribute first_name in my table Subscribers. Its width attribut is 150 varchar2().

You indeed need to access the EOEntity object for that.

EOEntity entity = EOUtilities.entityNamed( session().defaultEditingContext(), "NameOfEntity");
EOAttribute attribute = entity.attributeNamed("nameOfAttribute");
int width = attribute.width(); //whatever you entered in eomodeler



Hope this helps, --Jonathan


Now when subscribers are entering the first_name field through the web interface I would like to do some length check (what if the subscriber enters a name longer than 150 characters?) (please bear with me this is just an example albiet a bad one)

In my validation mathod I would like to check if the string entered is greater than the set width of the field of the table (whatever it may be). I can put in a preset 150 characters but that is no fun (because if you change the character width later on you will have to go through the code and change all instance of 150 character width).

Is it possible to retrieve the width of an attribute in the program ?


A. Shiraz 44 Executive Boulevard Elmsford, NY 10523 (914) 592- 4203 x268


_______________________________________________ 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: 
 >How To Check Attribute's Width Programmatically? (From: email@hidden)

  • Prev by Date: How To Check Attribute's Width Programmatically?
  • Next by Date: Re: How To Check Attribute's Width Programmatically?
  • Previous by thread: How To Check Attribute's Width Programmatically?
  • Next by thread: Re: How To Check Attribute's Width Programmatically?
  • Index(es):
    • Date
    • Thread