in

InfoPath Dev

Problem with displaying repeating text box in an email subject / attachment name, upon form submission

Last post 07-14-2008 10:25 AM by Hilary Stoupa. 20 replies.
Page 1 of 2 (21 items) 1 2 Next >
Sort Posts: Previous Next
  • 07-11-2008 11:30 AM

    Problem with displaying repeating text box in an email subject / attachment name, upon form submission

    I currently have a form that contains a repeating section with only one textbox within.  This text box is for employee names.  When the form submits, it creates an email with an attachment and subject that reference the employee names text box.  I get it to display multiple employees however each one has numerous underscores that trail making it pretty rough when you have 10 or 12 employees.   

    Ex.   Subject:  New Hire Announcement - Name1_____________________Name2_________________Name3______________ ,etc. 

    Any ideas?  Thanks,

  • 07-11-2008 11:51 AM In reply to

    Re: Problem with displaying repeating text box in an email subject / attachment name, upon form submission

    Hello and welcome!

    What is the formula you are using in your subject line on your email submit?

    Hilary Stoupa / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-11-2008 12:32 PM In reply to

    Re: Problem with displaying repeating text box in an email subject / attachment name, upon form submission

     concat(ddlEngagementType, " Project Announcement - ", group5, " - ", ddlPractice, " - ", ddlEmployeeClassification)

    group5 being the reference to the data in question.

    Thanks for the quick response!

  • 07-11-2008 12:58 PM In reply to

    Re: Problem with displaying repeating text box in an email subject / attachment name, upon form submission

    What does your schema look like? Does this return all the different names from your repeating field with the name in it? 'Cause when I tried it in a demo, I just got the first name in my group (which is what I would expect, actually).

    Here is a post that I read recently that explains a way to concatenate the data from a repeating group: http://www.infopathdev.com/forums/p/7124/30286.aspx#30286

    Modified for my data structure (and without the conditional element), the formula looked like this:

    eval(eval(RepeatingGroup, 'concat(my:TextField, " --  ")'),"..")

    This returns all the values of the field my:TextField separated by a space, two dashes and another space. The only thing is -- it leaves those spaces and dashes hanging off the end of the last item! Not very pretty. However, with a little substring magic:

    substring(eval(eval(RepeatingGroup, 'concat(my:TextField, " --  ")'),".."), 1, string-length(eval(eval(RepeatingGroup, 'concat(my:TextField, " --  ")'),"..") - 4)

    The substring is taking the string created by the first formula, and, starting at the first character, returning the length of that string less 4 (the final space dash dash space bit).

    Now, if you were to replace group5 in your formula with the first formula (inserting your group5 field in for RepeatingGroup and typing in your field name with the names for my:TextField) it would return a string of names separated spaces and dashes. Of course, you can modify the separator. You may want to try this formula out in another field in your form before putting it in the subject line on your email submit connection -- it will be easier to troubleshoot.

    Hilary Stoupa / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-11-2008 01:13 PM In reply to

    Re: Problem with displaying repeating text box in an email subject / attachment name, upon form submission

    Actually, sorry about this, but group5 refers to the repeating section that contains the textbox.  With this setup it does show all the textbox values in the form.  Let me know if based on this your response is still valid.  Thanks!!!!!

  • 07-11-2008 01:37 PM In reply to

    Re: Problem with displaying repeating text box in an email subject / attachment name, upon form submission

    Oh, sure, the double eval formula will work. I'm just perplexed as to why you are getting all your values w/ the reference to your group and I am only getting one of mine. Just because I'm stubborn and curious, could you open that formula again and select Edit XPath and copy and paste that for me?

    Hilary Stoupa / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-11-2008 01:42 PM In reply to

    Re: Problem with displaying repeating text box in an email subject / attachment name, upon form submission

    I won't be back on until Monday to test but,

    Subject: concat(ddlEngagementType, " Project Announcement - ", group5, " - ", ddlPractice, " - ", ddlEmployeeClassification)

    File Name Attachment:  concat(group5, " - ", tbClientName)

    Does the same in 2003 and 2007.  

  • 07-12-2008 05:16 AM In reply to

    Re: Problem with displaying repeating text box in an email subject / attachment name, upon form submission

    I think I was a little unclear. Would you click the formula editor next to the Subject area, and, when the formula window opens, select the checkbox that says Edit XPath (directions can be found here). Then copy and paste the formula. I would expect it to look more like:

    concat(my:myFields/my:ddlEngagementType, "Project Announcement-", etc.

     

    Hilary Stoupa / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-14-2008 05:59 AM In reply to

    Re: Problem with displaying repeating text box in an email subject / attachment name, upon form submission

     xpath values:

     Subject Line:    " concat(my:ddlEngagementType, " Project Announcement - ", my:group5, " - ", my:ddlPractice, " - ", my:ddlEmployeeClassification) "

    Attachment Line:   " concat(my:group5, " - ", my:tbClientName) "

     

    I'm getting ready to give your fix a try.  I'll let you know.  Thanks for all your help so far.

  • 07-14-2008 06:01 AM In reply to

    Re: Problem with displaying repeating text box in an email subject / attachment name, upon form submission

     more info, sorry. 

    So i'm viewing my data source and realize i'm not referencing the repeating section directly, but the folder it puts it in.

    group5

        rsResourceName     the repeating section

            tbResoruceName          the textbox in the repeating section.

     

  • 07-14-2008 07:03 AM In reply to

    Re: Problem with displaying repeating text box in an email subject / attachment name, upon form submission

     Ok, I got it to work using both versions of code:

    Formula:  "  substring(eval(eval(rsResourceName, 'concat(my:tbResourceName2, " , ")'), ".."), 1, string-length(eval(eval(rsResourceName, 'concat(my:tbResourceName2, " , ")'), "..") - 3))  "

    Now for the million dolloar question:  How can I put this repeating text box along with other static text boxes into a subject line?

     

    Example:  Subject = New Project Announcement: tbClientName - tbResourceName2(from the repeating section above) 

    or should this be another post?

  • 07-14-2008 07:12 AM In reply to

    Re: Problem with displaying repeating text box in an email subject / attachment name, upon form submission

    I'm glad you got your formula to work! Your text box is bound to a field. You can use that field in your subject line. To see what field your text box is bound to, select the text box and it will show you the name of the field. Of course, you can also use the formula that is working in the text box in the subject line of the email -- I had wanted you to try it in a text box because it is faster to see when you have it right -- you can just preview the form and fill out a few fields without having to take the extra step of submitting to see if it works.

    Hilary Stoupa / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-14-2008 07:28 AM In reply to

    Re: Problem with displaying repeating text box in an email subject / attachment name, upon form submission

     I think I answered my own question, which I'll post later, but it seems my formula above doesnt quite give me the results I hoped for.  Instead of removing the last 3 characters, it only posts 3 characters the first 3.   I'm so close I can taste it.  Any thoughts?  This stuff is just a little over my head. 

     

     Just realized what you meant by trying that formula in a text box.  Brilliant!  ;-)

  • 07-14-2008 07:40 AM In reply to

    Re: Problem with displaying repeating text box in an email subject / attachment name, upon form submission

    You have a little issue w/ your parenthesis at the end of your formula. Instead of - 3)) try ) - 3)

    Hilary Stoupa / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-14-2008 07:41 AM In reply to

    Re: Problem with displaying repeating text box in an email subject / attachment name, upon form submission

     I did that and got this error:

     Expected value type: ,

    Actual value: end-of-string
    concat(substring(eval(eval(../my:group5/my:rsResourceName, 'concat(my:tbResourceName2, " , ")'), ".."), 1, string-length(eval(eval(../my:group5/my:rsResourceName, 'concat(my:tbResourceName2, " , ")'), "..") - 3), " - ", ../my:tbClientName)<--

     Just so happens adding it in resolved the error  but made it work incorrectly.  I have no idea what this error is telling me....

     

     

Page 1 of 2 (21 items) 1 2 Next >
Copyright © 2003-2007 Qdabra Software. All rights reserved.
View our Terms of Use.