Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Once Again.. emailing from XSL

Featured Replies

I have tried everything under the sun...hoping someon can help out. I am attempting to email results from a form. The email shows up perfectly. The subject line is perfect..... the info in the Body of the email i cannot get correct. Here is my code for the email: (note that 'Sel' & 'Title' are fields in my database) The result of this would be--- SelTitle---- with no breaks. How can I get the email to format with all my data broken into seperate lines.

xsl:variable name="email_status" select="fmxslt:send_email('[email protected][email protected]&subject=Music Connection has received your BOM&',concat('Sel#:',fmrs:resultset/fmrs:record/fmrs:field[@name='Sel'],/,'Title:',fmrs:resultset/fmrs:record/fmrs:field[@name='Title']))"/

thanks for any input

Brad

I'm little bit too nitpicking (correct expression?), but can you assume that you always get back one record in resultset? Otherwise you should really address the record.

Why do you need the / between the two commas (this would be the XPath of the root node of your XML tree)?

Try this:

<xsl:variable name="bz" select="fmrs:resultset/fmrs:record[1]">

<xsl:variable name="email_status" select="fmxslt:send_email('[email protected][email protected]&subject=Music Connection has received your BOM',concat('Sel#:',$bz/fmrs:field[@name='Sel']/fmrs:data[1],&xD;,'Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1]))"/>

The &xD; is the character expression for the carriage return.

Martin

  • Author

Thank you for the code...i will test it out.

What do you mean by "really address the record"? If b yt his you mean show the entire record the YES! How would I do this?

thanks Again

Brad

It's already there in my example: fmrs:resultset/fmrs:record[1] means "take the first record of my resultset".

Martin

  • Author

Using your exact code I am getting an error of "The reference to entity sunject must end with a ';' delimiter

I canot seem to get this corrected. Any suggestions?

thanks

brad

  • Author

Also telling me that the &xD was reference but not declared. Sorry for the basic questions but I am a newbie just trying to help out my family business.

Sorry, made two little mistakes. Try this:

<xsl:variable name="bz" select="fmrs:resultset/fmrs:record[1]"/>

<xsl:variable name="email_status" select="fmxslt:send_email('[email protected][email protected]&subject=Music Connection has received your BOM',concat('Sel#:',$bz/fmrs:field[@name='Sel']/fmrs:data[1],'&#xD;','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1]))"/>

  • Author

hmmm... nothing posted above. Can you repost?

Look again at the post above. Strange - I was pretty sure my answer showed 3-4 days ago. This forum engine sometimes seem to intermingle "&lt;" and "<"

Martin

  • Author

Beautiful... that works. Now this leads into a new issue though. In actuality I have about 30 fields that need to be listed in this email. It seems as soon as I get to about 20 lines I get the follwoing error:

java.lang.ArrayIndexOutOfBoundsException: 16

I think this is a limit to the size of the string. Do you know how to increase this size?

For refernce here is the code I am using now:

xsl:variable name="bz" select="fmrs:resultset/fmrs:record[1]"/

xsl:variable name="email_status" select="fmxslt:send_email('[email protected][email protected]',

concat('Sel#:',$bz/fmrs:field[@name='Sel']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Artist']/fmrs:data[1]))"/

Interesting, it seems that concat() has a limited number of strings to be concatted. Did you try nested concats?

Or even, you can save half of your

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1] construct in a variable first:

<xsl:variable name="firsthalf" select="

concat(' Title:',$bz//fmrs:field[@name='Title']/fmrs:data[1],' Title:'....)"/>

and the other half: <xsl:variable name="secondhalf" select="analogous..."/>

and then:

<xsl:variable name="email_status" select="fmxslt:send_email('[email protected][email protected]&subject=Music Connection has received your BOM',concat('Sel#:',$bz/fmrs:field[@name='Sel']/fmrs:data[1],' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],$firsthalf,$secondhalf))"/>

BTW, you can substitute 'bz' by 'record' (that was a little joke I tried to find out if you are "the" brad2610).

Martin

  • Newbies

As a side note is there any ability for XSL to call the email address from the completed form and send an email to that user i.e. feedback from form logged, I have tried something like this but there is no response at all via the browser

xsl:variable name="email_feedback" select="fmxslt:send_email(fmrs:resultset/fmrs:record/fmrs:field[@name='Email2']/fmrs:data,'[email protected]&subject=Job Logged',concat(fmrs:resultset/fmrs:record/fmrs:field[@name='LocationE']/fmrs:data,' ','Descr:',fmrs:resultset/fmrs:record/fmrs:field[@name='FaultDescription']/fmrs:data))"/

Tomos

Seems to get a long thread here wink.gif

One of the three variants of the fmxslt:send_email extension function is of the following form:

fmxslt:send_email(String smtpFields, String body)

Now you have something like: fmxslt:send_email(String to_address, String remaining_smtpFields, String body). Compare with your construct.

Therefore, you should concat the strings to_address and remaining_smtpFields like this:

<xsl:variable name="email_feedback" select="fmxslt:send_email(concat(fmrs:resultset/fmrs:record/fmrs:field[@name='Email2']/fmrs:data,'[email protected]&subject=Job Logged'),concat(fmrs:resultset/fmrs:record/fmrs:field[@name='LocationE']/fmrs:data,' ','Descr:',fmrs:resultset/fmrs:record/fmrs:field[@name='FaultDescription']/fmrs:data))"/>

Martin

  • Newbies

May the choirs of the heavens sing you to sleep.... Fantastic, I tried using concat, but neglected to include the from string.

It works, it works, it works..... laugh.gif

if you had not guessed I was kind of impressed. I have had issues migrating my databases from Fm6 to 7 as I utilise a lot of AppleScript to complete the short comings of Filemakers GUI (mind you try doing some of my scripts in any other Database app.... wink.gif), but nothing prepared me moving from CDML (Database web forms 101) to XSL.....

Thanks heaps

Tomos grin.gif

BTW, if anyone is looking at implementing this there is only one small addition that has to be made to the code, between the ampersand and the "subject" name you will need "amp;" i.e. .au&amp;subject

Minor really......

  • Author

Martin you are a genius... Nesting the concat was perfect run around to the string limts.

Thanks again!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.