If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Email Hyperlink

Started by gp4570, 04 Jun 2010 02:34:06 PM

Previous topic - Next topic

gp4570

I have a report that I have created using Report Studio.  The Report list contact info of those who work for the company.  One of the fields I have pulled into the report is the email address for each person.

What I would like to do is to make the email address a hyperlink.  When the user clicks on the email address I want MS Outlook windo to open with the email address in the To: line ready start typing a email.

Any ideas on how I can make this happen?

Thanks -- Todd

CognosPaul

If the report is opening in HTML you can drag an HTML item before field in the list (unlock the report first), set it to report expression, and paste:

'<a href="mailto:' + [email] + '?subject=Cognos Rocks&body=This is the default body of the email, you can delete this if you want.">'

And another HTML item (text) after the field with
</a>

gp4570

I added the two HTML items one before the field:

The first HTML item I set the source type to report expression and put exactly this in the report expressioin '<a href="mailto:' + [email] + '?subject=Cognos Rocks&body=This is the default body of the email, you can delete this if you want.">'

The second HTML item I set the source type to report expression and put exactly this in the report expression [/url]


This is the error I got  An error ocurred at or near the position '21'. The variable named '[email]' is invalid.


CognosPaul

The reason you're getting the "variable invalid" error is because you're not including the field [email] in the list.

When you reference fields in report expression they have to match exactly what you have in the query. So if the data item is, for example, Employee Email, you need to reference [Employee Email] in the expression. Also, if you're not including that field as an object inside the list, for example if you want to include the email only as a hyperlink on the name field, you need to include it in the list properties. The properties field (inside the properties on the bottom left) forces Cognos to include specific data items in the SQL.

Finally, remember your HTML, that [/url] may not be correct to close the anchor tag.

It wasn't a mistake! The forum software automatically changed < / a > to </a>!

gp4570

Well I am still trying to get this to work.  I have two HTLM items one on either side of my data item named Email Address which is coming from a query named Report Query.

HTML Item #1
<A HREF="mailto:[Report Query].[Email Address]">


HTML Item #2
< /A>

When I try to validate HTML Item #1 I get:
RSV-VAL-0002 Invalid expression<A HREF="mailto:[Report Query].[Email Address]">.CRX-YXX-4010 A parsing error was found at or near the position 0 in the expression "<A HREF="mailto:[Report Query].[Email Address]">".


When I try to validate HTML Item #2 I get:
RSV-VAL-0002 Invalid expression </A>. CRX-YXX-4010 A parsing error was found at or near the position 0 in the expression "</A>.".

Thanks for your help thus far as I have learned some things that I did not know before!

CognosPaul

Almost there.

The thing to remember is that report expressions need to be treated as query items. It's trying to interpret <A href... as a function instead of pure text. Instead you need to put single quotes to notify Cognos that it's a string. Concatenate the email address with a +.

It should look like '<a href="mailto:' + [Email] + '">' (that's a single quote followed by a double quote there)


The last HTML item should be set to text or have the < /a> in single quotes.

gp4570

No errors with the syntax now  ;)

HTML Item #1 now looks like:
'<A HREF="mailto:' + [Report Query].[Email Address] +'">'

HTML Item #2 now looks like:
'< /A>'

I can run the report and it works in PDF but not HTML?  In PDF I can click on email address of the person and Outlook window pops up the the email address of ther person selected in the To:

When I run the report -HTML the email address field is not functioning like a hyperlink?  Running in PDF I get a little "hand" icon when I mouse over the email address which is as it should be.  Can I change the color of the email address so it stands out when the report is run from the the ohter data item fields?

gp4570

I got the font color for the email address data item changed to a different color but still don't have running the report in HTML working for the email address mailto feature??


gp4570

Thanks for the link it will come in handy :)

gp4570

Report now runs via HTML and PDF  ;D

We had some Java script on our default report template which was causing the HTML output to not work properly.  I took the Java script out of the reprot and it runs fine now.

Thanks for the help !

Robert Kostecki

Please note for the e-mail hyper-link to work in Cognos 10.1 Excel 2007 output you need Fix Pack 2 (http://www-01.ibm.com/support/docview.wss?uid=swg1PM54866)

kc9400

I know this is an old post but it covers what I'm working with.

I do have an additional question,

'<a href="mailto:' + [signEmail] + '?subject= DATA &body= DATA ">'


In this, how would I get the subject to use a data item value and the body to contain data item values aswell?
When life gives you lemons, throw them at someone.

bdbits

It's just a string expression, so something like:

'<a href="mailto:' + [signEmail] + '?subject= ' + [youritem] + '&body= ' + [youritem1] + ' ' + [youritem2] + '">'

roddawg

I used a calculated field [mailto] in my query. Then build a simple string 'mailto:'+[userid]+'@domain.com?Subject=Duplicate Sales Entry&body=Please see me regarding Sales entry for ID:'+left([Customer Sales ID],7)+' '+[Name Last-First-Middle]+ ' on '+left(cast([Sales Date] as varchar(20)),10)
notice the single quotes.  Then insert a hyperlink object make the URL source =[mailto] text source = 'Click to email user'

neha_cognos

can i also attach report output itself with this method or attach/paste a screenshot of a visualization ( eg- crosstab in my case)