none
Infopath 2007 'NaN' error

    Question

  •  

    Hello,

    I am building a form in InfoPath 2007 with an ‘email’ data connection set up.

    What I would like to do, is create a custom/code driven (subject line) to send when the form is submitted.  This is all well and good, except I keep getting ‘NaN’ values when creating two or more formulas in the subject line of the submission.

    Example: Fname + “ – Form Submission – “ + Alias

    What I am trying to do here, is pull the Fname value and the Alias value from the form and have static text (Form Submission) in the middle.

    End result: Bob – Form Submission – bobtest

    If I simply have one field ‘Fname’ pull upon submission, everything is fine.  However, as I said when it is in conjunction with two or more I only get the NaN value in the subject line.

    I am using InfoPath 2007.

    Does anyone have any ideas on how I can resolve this?  Perhaps I do not have something installed, but I assume I do.

    Thank you for any suggestions…

    Cheers,
    Ryan

    Monday, February 11, 2008 11:47 PM

Answers

  • What are the errors that you are getting when you paste the formula in the "Insert Formula" dialog box saying? Click on the "Show Details" button on the error message box to see more details on an error. Perhaps the references to the fields are incorrect?

     

    Try using the "Insert Field or Group" button on the "Insert Formula" dialog box to select the fields from your form and replace the Fname and Alias in the concat() function with those. So instead of copying/pasting the formula I've provided, use the "Insert Field or Group" and "Insert Function" buttons on the "Insert Formula" dialog box to generate the entire formula. And make sure you include spaces between the commas.

     

    The concat() function should work when you use it in the "Insert Formula" dialog box.

     

    Wednesday, February 13, 2008 5:43 AM

All replies

  •  ~ ryros ~ wrote:

     

    Hello,

    I am building a form in InfoPath 2007 with an ‘email’ data connection set up.

    What I would like to do, is create a custom/code driven (subject line) to send when the form is submitted.  This is all well and good, except I keep getting ‘NaN’ values when creating two or more formulas in the subject line of the submission.

    Example: Fname + “ – Form Submission – “ + Alias

    What I am trying to do here, is pull the Fname value and the Alias value from the form and have static text (Form Submission) in the middle.

    End result: Bob – Form Submission – bobtest

    If I simply have one field ‘Fname’ pull upon submission, everything is fine.  However, as I said when it is in conjunction with two or more I only get the NaN value in the subject line.

    I am using InfoPath 2007.

    Does anyone have any ideas on how I can resolve this?  Perhaps I do not have something installed, but I assume I do.

    Thank you for any suggestions…

    Cheers,
    Ryan

     

    It's unclear to me whether you are writing code or not, since you mentioned "a custom/code driven (subject line)", but if you're just using formulas, you can use the concat() function as in:

     

    concat(Fname, "-Form Submission-", Alias)

     

    Tuesday, February 12, 2008 5:34 AM
  •  

    Hello,

    Thank you for that response, and I apologize on the confusion.

    I am trying to use a formula to pull information from the form and populate that in the subject line of an email (see my example above).

    So I am looking at the ‘data connections’ dialog for an ‘email submitted’ form submission.  I am trying to make a custom subject line for the email that is sent with the form information.  I found this idea while reading (Pro InfoPath 2007 – Philo Janus – pg 139), but the example provided does not work either.

    When pasting in your formula into the ‘subject line’ area, when the form is submitted, it simply provides a duplicate of the formula (no data pull is done).  When I paste it into the ‘insert function’ dialog box, it will not resolve due to ‘errors’.

    This process is frustrating because nothing is working; I have no idea why I am getting this NaN message when sending the form ‘even using the pre-defined formulas’.

    Again, everything works ‘if’ I use just 1 pre-defined formula; however, that does not add any real value at the end of the day.

    If you have any additional ideas, that would be great.

    Cheers,
    Ryan

    Tuesday, February 12, 2008 6:08 PM
  • What are the errors that you are getting when you paste the formula in the "Insert Formula" dialog box saying? Click on the "Show Details" button on the error message box to see more details on an error. Perhaps the references to the fields are incorrect?

     

    Try using the "Insert Field or Group" button on the "Insert Formula" dialog box to select the fields from your form and replace the Fname and Alias in the concat() function with those. So instead of copying/pasting the formula I've provided, use the "Insert Field or Group" and "Insert Function" buttons on the "Insert Formula" dialog box to generate the entire formula. And make sure you include spaces between the commas.

     

    The concat() function should work when you use it in the "Insert Formula" dialog box.

     

    Wednesday, February 13, 2008 5:43 AM
  •  That worked!

     

    When I used the concat( ) in conjunction with the Insert Function fields, it worked.  I did not get any compile errors, nor did it provide the NaN error.

     

    I did some research on the ‘concat()’ function and believe I understand why I was receiving the errors I was receiving.  However, I guess I just assumed because I was using an ‘editor’ I didn’t need to include additional function to do this work.  Perhaps, because the ‘value types’ were different, it needed an additional function to make this happen.

     

    If you have extra information on why this didn’t work before, defiantly let me know.  If not, a sincere Thank you for your help on this.

     

    Rock on…

     

    Cheers,

     

    Wednesday, February 13, 2008 11:15 PM
  • Glad it worked!

     

    I'm not sure which situation that did not work before you are referring to, but if you mean your first attempt using the plus sign, I can only guess that InfoPath tried to convert the fields or summation of the fields to numbers when you used the plus sign, which is why you got a NaN (Not a Number) error.

     

    Thursday, February 14, 2008 4:55 AM
  • Thanks.  The solution here helped me a lot.  Does anyone know how to put a carriage return in this type of formula.

     

    Example:

     

    concat(today() , " " , username() , "-" , NotesField)

     

    Now I want a carriage return to skip a line and another return to add another field, NotesLog.

     

    in vbscript  ctl13 works and html <br> works.  Don't know what to do in these rules.

     

    Thursday, April 24, 2008 2:52 PM