Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Problem retrieving data from data sources in a script variable
sotirisioannou
<p>So I've been working on a report and I have this very weird problem so I would be glad if you could help me .</p>
<p> </p>
<p>So I have a table which is constructed by a left join of two data sources. Everything seems fine however I'm having serious problems reading from the database to a script. My code looks like this:</p>
<p> </p>
<p> </p>
<p>test1 = <value-of>row</value-of>;</p>
<p> </p>
<p>test2 = <value-of>row</value-of>;</p>
<p> </p>
<p>test3 = <VALUE-OF>row["text"]</VALUE-OF><br>
</p>
<p>So, I can get the values of test1 and test2 and output them using console.log(), but no matter what I do I cannot get the output of test 3.</p>
<p> </p>
<p>I know it's hard to provide an answer on this but could you please guide me towards the solution by answering the following questions?</p>
<p> </p>
<p>1. Does the data type of the row (decimal,string etc) plays a role on how we should use <VALUE-OF>?</p>
<p> </p>
<p>2. Do we need to include the table name on <value-of>row</value-of>; ?</p>
<p> </p>
<p>3.Do we need to have any sort of calculation to have the data retrieved? (for example in test1 and test2 I am dividing by a number)</p>
<p> </p>
<p>Generally if you can think something that it could help me like what others have done in similar situations please let me know !</p>
<p> </p>
<p> </p>
<p> </p>
Find more posts tagged with
Comments
mwilliams
No, you don't need to perform a calculation. What you have should work as long as the field name is the same as what shows in the dataset after the join. You'll also need to make sure that the text element has access to that field. Be sure to check your bindings of the text element or grid/table that the text element is inheriting data from to be sure you have the binding available. Are you getting any errors?
sotirisioannou
<p>Hi,</p>
<p> </p>
<p>Thanks for helping me out. No I'm not getting any errors and I still have the same problem. I've made sure that the field has the same name as the dataset(the one that has been created when I've joined the two other data sets).</p>
<p> </p>
<p>Any ideas?</p>
sotirisioannou
<p>Actually,</p>
<p> </p>
<p>I do get some errors from BIRT. I get the "Not defined error" for the field. How can I fix this?</p>
<p> </p>
<p>Also, when I've tried to put the name of the table on the front like this :</p>
<p> </p>
<p><VALUE-OF>row["Table.text"]</VALUE-OF> I get output on the console this " nothing to output"</p>
<p> </p>
<p>Thanks</p>
mwilliams
Could you please attach your design?
sotirisioannou
<p>Hello thanks, but I think I've found the solution</p>
<p> </p>
<p>So it seems that when you are trying to read from database strings then you do have to include quotes on the outer part of <value-of> like this:</p>
<p> </p>
<p> " test3 = <VALUE-OF>row["text"]</VALUE-OF> "</p>
<p> </p>
<p>If it's a decimal then you omit the quotes:</p>
<p> </p>
<p> test3 = <VALUE-OF>row["decimal"]</VALUE-OF></p>
mwilliams
If you run into any other issues with this, let me know.