• 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: Converting Number Type EOCustomObjects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Converting Number Type EOCustomObjects


  • Subject: RE: Converting Number Type EOCustomObjects
  • From: "Jonathan Fleming" <email@hidden>
  • Date: Fri, 21 Feb 2003 16:11:10 +0000

But what happens when I need to get a Number Object back into the database that is now an int type, how do I reconvert that? A Number type won't accept an int type.
I've seen methods to convert everything that is a Number or String into int's, float's, long's, double's etc but not from any of these back to Number types and the EO's won't accept anthing other than the type that it is... a Number


Jonathan






From: "Fournier, Pete" <email@hidden>
To: "Jonathan Fleming" <email@hidden>
Subject: RE: Converting Number Type EOCustomObjects
Date: Fri, 21 Feb 2003 10:52:20 -0500

Not hard at all. You are dealing with a Number object. Check out the
documentation for the JDK available at www.javasoft.com It will be worth
your while to become familiar with Java and how its objects work.

If you want the int value of your number object you can just do

Number myVar = <whereever you get it from>;

If(myVar != null && myVar.intValue() > 0)

Or whatever you would like to check.

Pete Fournier


-----Original Message----- From: Jonathan Fleming [mailto:email@hidden] Sent: Friday, February 21, 2003 10:34 AM To: email@hidden; email@hidden Subject: Converting Number Type EOCustomObjects


I'm having a real nightmere just trying to convert two Number object types in my EOCustom code so that I can do a simple addition on their values.

I've given up trying to tidy the code up so you have to forgive the mess
you
witness here, this is as far as I have got with it:
I don't understand why I am not allowed to use operator to read if a
value
is > 0 or == 0 and so forth?  Nor can I use (+) symbol says the
projectBuilder compiler to add the two values together even if the code
was
right, and converting the EO's is just winding me up... 8 hours I've
been at
this nonesense (UK time), it should have been real easy.
Can someone please help before I go out of my tiny mind...
All I want to do is add one EOCustomObject that is a Number type to
another
EOCustomObject that is a Number type, how hard can that be?

public WOComponent dbSaveChanges(){
        try {

            // get editing context
            EOEditingContext ec = session().defaultEditingContext();

            // this checks if a number was entered into the
countOfImagesToUpload variable
            if (getSCountOfImagesToUpload().equals("0"))
            {
                Number sum;
                Number nCountOfImagesUploaded = (Number)
tbClient.valueForKey("countOfImagesUploaded");
                Number nCountOfUploadMatch = (Number)
tbClient.valueForKey("countOfUploadMatch");
                // Something was uploaded, update the EO
                tbClient.setCountOfImagesUploaded(
getSCountOfImagesToUpload().intValue() );
                if (nCountOfUploadMatch > 0) {
                    sum = nCountOfImagesUploaded + nCountOfUploadMatch;
                    tbClient.setCountOfUploadMatch(sum);
                } else {

tbClient.setCountOfUploadMatch(getSCountOfImagesToUpload());
                }
            }

_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger
http://messenger.msn.co.uk
_______________________________________________
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.


_________________________________________________________________
Chat online in real time with MSN Messenger http://messenger.msn.co.uk
_______________________________________________
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: ADC-TV
  • Next by Date: RE: Converting Number Type EOCustomObjects
  • Previous by thread: Converting Number Type EOCustomObjects
  • Next by thread: RE: Converting Number Type EOCustomObjects
  • Index(es):
    • Date
    • Thread