Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
Javascript String functions not working
Migrateduser
<p>Hi, I'm trying to use the charCodeAt() function from BIRT's Javscript String Functions in the Palette. I keep getting the error "TypeError: Cannot find function chareCodeAt in object 244004385"</p><p> </p><p>244004385 is the value of an integer parameter that is passed in to the report. I'm trying to use that in some Javascript code where I need to get the ascii code values of each character and add them up. Strangely if I run "charAt()" instead which is supposed to return the actual character that actually works except that it's return the code I'm after. I.e. index 0 gives me 50 instead of 2, or index 1 gives me 52 instead of 4. Here's a snippet of the code I'm using. I've tried using both the actual parameter (dragged in from the palette) or in the case of the first line below a page variable where I took the parameter and assigned it to the page variable with "params["ca_blockId"].value.toString()" in expression builder for the page variable.</p><p> </p><div><pre class="_prettyXprint">blockId = vars["pv_ca_blockId"];blockIdLength = BirtStr.charLength(blockId);currentPosition = 0;stringToNum = 0;while (currentPosition < blockIdLength){ stringToNum = blockId.charCodeAt(currentPosition) - 48; currentSum += stringToNum; currentPosition++;}</pre></div><p> </p>
Find more posts tagged with
Comments
There are no comments yet