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

Get data item value in javascript (HTML tag)

Started by clingst, 24 Mar 2015 01:52:06 AM

Previous topic - Next topic

clingst

Good day peeps,

Hope to have your advice how can I put the value of data item in alertbox.

I tried below

<script>
alert('''+[Query1].[eventCount]+''');
</script>

but not working..

I keep on getting the error

Expected ')'

it seems like the JS script is broken..
i did mass research but hardly get the right way to code it..
please advice...

thank u

AM

You can't access data items directly from javascript. I'm also not sure what the three single quotes are for, and I think that's what is causing your validation error... the first ' opens a string, the second ' closes the string, then the third ' is a syntax error; the alert function is looking for ) as it's got the string and is now ready to close.

One way to access it would be to populate a prompt item with the data item, then use the prompt API.

CognosPaul

You can put it in, but you will run into problems if you have quotes in your text. Make sure you're using a report expression and remember to put the a quote at the beginning and end of the text. Also, make sure your data container has eventCount ticked in the properties.