• 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: WOMailDelivery Woes - Data Types incorrectly set?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOMailDelivery Woes - Data Types incorrectly set?


  • Subject: Re: WOMailDelivery Woes - Data Types incorrectly set?
  • From: Janice Cheung <email@hidden>
  • Date: Tue, 25 Oct 2005 15:04:25 -0400

    Hi Mark,

    Thank you for writing!

    Your solution addressed my problem perfectly!  I was able to save to the database using the NSArrays as you described.

    Thank you again for all of your help!  :)

    Best regards,
    Janice

Mark Morris wrote:
Hello again Janice,

I might be missing something, but which part of your problem does my answer not address?  I'd be happy to follow up.

Regards,
Mark

On Oct 19, 2005, at 3:34 PM, Mark Morris wrote:

Hi Janice,

There's a very simple solution to your problem.  :-)

In composePlainTextEmail, the arguments for both the "to" and "bcc" are each NSArrays, not Strings.  So you don't need to go through the exercise of concatenating them together with commas like that.

And, as an aside, if you ever have to do such concatenation, there are two very handy methods you might like.  The NSArray method componentsJoinedByString( String separator ) will would have let you rewrite your getEmailContactNames method like this:

public String getEmailContactNames() {
   return ( (NSArray)storedValueForKey( "serverContacts" )).componentsJoinedByString( "," );
}

The companion method is a static NSArray method, componentsSeparatedByString( String string, String separator ), which will take, for example, a comma-delimited String and return an NSArray of the components within.

Regards,
Mark

On Oct 19, 2005, at 11:13 AM, Janice Cheung wrote:


    Greetings!

    I have a question about WOMailDelivery.  I am able to properly send out e-mails using WOMailDelivery features,
    but when it comes time to edit the "to" String as bound in WOTextField binding, my WOMailDelivery does not take
    in the modified e-mail values.

    More specifically, my "to" String is set to binding value server.getEmailContacts.  In reference to the "to" String:

    WOMailDelivery mailer= WOMailDelivery.sharedInstance();
    Msg=mailer.composePlainTextEmail(from, to, cc, subject, Msg, sendNow);

   
I have defined get() and set() methods for the string value, EmailContacts.  I think the problem lies in my set() method, but
    I am unsure as to exactly what I am doing wrong.  Here are my methods: 

    public String getEmailContactNames(){
       NSArray pc=(NSArray)storedValueForKey("serverContacts");
       java.util.Enumeration e = pc.objectEnumerator();
       StringBuffer tags=new StringBuffer();
       Set emails=new HashSet();
       while (e.hasMoreElements()){
          ServerContact loc=(ServerContact)e.nextElement();
          String email=loc.contact().fullName();
          if (!emails.contains(email)){
             tags.append(email);
             tags.append(",");
             emails.add(email);
        }
    }
       return tags.toString();
        }


    public void setGetEmailContactNames(String value)
     {
       value=getEmailContactNames();
     }

    I feel as though the setGetEmailContactNames() method is incorrect because I am also unable to save changes of this WOTextField binding
    to the database.  Am I somehow supposed to tokenize the concatenated
tags String in my set() method?  I do not quite understand what I am
    doing wrong...

    Thank you very much for helping me.  I really appreciate your help!

    Kindest regards,
    Janice
 _______________________________________________
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

 _______________________________________________
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

 _______________________________________________
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

References: 
 >WOMailDelivery Woes - Data Types incorrectly set? (From: Janice Cheung <email@hidden>)
 >Re: WOMailDelivery Woes - Data Types incorrectly set? (From: Mark Morris <email@hidden>)
 >Re: WOMailDelivery Woes - Data Types incorrectly set? (From: Mark Morris <email@hidden>)

  • Prev by Date: Re: Referencing WO fields in JavaScript
  • Next by Date: Re: Set String methods for Flattened Relationship Attributes
  • Previous by thread: Re: WOMailDelivery Woes - Data Types incorrectly set?
  • Next by thread: NSDictionary and FetchSpecificationNamed usage
  • Index(es):
    • Date
    • Thread