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.