I am also interested in HTML mark-up for the outbound connector. Keep me posted! Katie
Good news on this ... the Message Formatter (used by the 'Send an Email' outbound connector) was enhanced at 10.4 to support HTML code. When configuring the output, use the new drop down to select HTML, and e-mail messages you send will display using HTML code you enter into the GeoEvent output connector's message body.
For example:
{
"Customer_Logo": "http://webapps-cdn.esri.com/Apps/MegaMenu/img/logo.jpg",
"Issue_Header": "Enhance Message Adapter with the ability to handle HTML content",
"Tech_Advisor": "Ming Zhao",
"Date_Reported": "June 2, 2014",
"Customer_Name": "Becks Hybrids",
"Customer_No": "123-45-6789",
"Contact_Phone": "1-800-937-2325",
"Customer_Address": "6767 E. 276th St.",
"City_State_Zip": "Downs, IL 61736"
}
<img src=${Corporate_Logo} alt='xxx' width='80'/> <h1 style='font-family:Segoe, Arial, sans-serif;font-weight: 700;'>${Issue_Header}</h1> <table style='font-family:Segoe, Arial, sans-serif;font-weight: 400;border-collapse:collapse;'cellpadding='5'> <tr style='background-color:lightgrey;'> <td style='font-weight:600;' width='130px'>Technical Advisor:</td> <td width='140px'>${Tech_Advisor}</td> <td width='50px'> </td> <td style='font-weight:600;' width='150px'>Date Reported:</td> <td>${Date_Reported}</td> </tr> <tr> <td colspan='5'> <table style='width:100%; border-bottom-style:solid; border-bottom-width:3px; border-right-style:solid; border-right-width:3px; border-bottom-color:#888888; border-right-color:#888888;'> <tr style='font-weight:700; font-size:larger; background-color:lightgrey'> <td colspan='5'>Customer Information</td> </tr> <tr> <td style='font-weight:600;' width='130px'>Customer Name:</td> <td width='160px'>${Customer_Name}</td> <td width='50px'> </td> <td style='font-weight:600;' width='150px'>Customer Number:</td> <td width='160px'>${Customer_No}</td> </tr> <tr> <td style='font-weight:600;vertical-align:text-top' width='130px'>Customer Address:</td> <td width='160px'>${Customer_Address} <br/> ${City_State_Zip}</td> <td width='50px'> </td> </tr> <tr> <td style='font-weight:600;vertical-align:text-top' width='130px'> </td> <td width='160px'> </td> <td width='50px'> </td> <td style='font-weight:600;vertical-align:bottom' width='150px'>Phone:</td> <td style='vertical-align:bottom' width='160px'>${Contact_Phone}</td> </tr> </table>
This was a 10.4 product enhancement.
- RJ
This is really cool but it looks like it is converting my decimal value into scientific notation. Is there a way to avoid it? I tried mapper processor to map to a string field but that doesn't help.
A cost value of 45,456,456,456 got converted to 4.5456456456E10 0.0 Any thoughts?
GeoNet sent me a message that you were having some trouble using basic HTML tags in the Message Body to simply display certain fields in BOLD. The following worked for me (entered as a single line of text):
<span style='font-weight:600;'>Vehicle ID:</span> ${VehicleID}<br/>
<span style='font-weight:600;'>LastUpdated:</span> ${LastUpdated}
The following also worked for me, using HTML tags rather than CSS Properties:
<strong>Vehicle ID:</strong> ${VehicleID}<br/><strong>LastUpdated:</strong> ${LastUpdated}
– RJ
Did you perhaps find an answer to your original question on how to BOLD text in your notification message, and re-post to ask about formatting decimal values in more user-friendly formats rather than scientific notation? GeoNet sent me a message about the former, but looking at the thread this morning, I'm seeing the latter.
In any case, for the question GeoNet is showing now, if the data you are receiving is a high precision value such that Java wants to use scientific notation to represent the value, I think you're stuck with the scientific notation. It's not a question of how to use the MessageFormatter (the adapter used to format an event record prior to sending an email or SMS text message request to an SMTP Server) to reformat a Double value 123456789000 to represent it as 123,456,789,000 rather than 1.23456789E11. The output's adapter does not support string formatting or data type conversion. The only formatting it offers is variable substitution ( e.g. ${VehicleID} ) and HTML / CSS formatting like what I've shown above.
As you've discovered, using a Field Calculator expression such as toString(myValue) to try and convert a Double value to a String simply represents 1.23456789E11 as the string literal "1.23456789E11". Unfortunately the Field Calculator does not support Java code such as String.format("%.0f", myValue) or java.text.DecimalFormat.format(myValue). The processor is only able to interpret a selection of string and mathematical functions for which wrappers have been developed as part of the processor's implementation.
Do you need to handle the cost value as a Double at any point in the GeoEvent Service? You might consider configuring the GeoEvent Definition used by your input to specify costValue be treated as a String, even though the data is arriving as a long integer value. You could use the attribute costValue in your e-mail notification message and (if necessary) use a Field Mapper to explicitly cast the String to a Double by mapping costValue into an event attribute field costValueAsDouble whose data type was Double.
Then you could use costValueAsDouble to perform any calculations you needed. But once cast to a Double I don't think you'll be able to revert a high precision value back to a String in order to avoid the data being represented in scientific notation. Also, using the input's inbound adapter to handle costValue as a String in the first place isn't going to format the string using commas to separate out the thousands portion of the value; it's just going to give you a really long string of digits.
– RJ