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)
Add columns to a data set from a globalPersistentVariable
ArK
<p>Hi,</p>
<p> </p>
<p>I have a JDBC data set and in the DB there's a table that contains 'extensions' for another table. I'm currently collecting these extensions to a globalPersistentVariable.</p>
<p>Is it possible to iterate this variable after it has been fetched and then add columns to another data set based on these values?</p>
<p> </p>
<p>To clarify:<br><br>
Let's say there's a table containing cars that are unique.</p>
<p>There's also an extension table that contains owners and dates for that car (identified by car_id)</p>
<p> </p>
<p>I want to add these owners to the car data set, but I can't join them as multiple owners would lead to multiple rows for the same car in the data set, right? <br><br>
Is it possible to collect the owner data (lets say only the names) and then add it as columns for a single car or is there a more simple / better way of implementing this?</p>
<p> </p>
<p>Thanks,</p>
<p>Arto </p>
<p>
</p>
Find more posts tagged with
Comments
pricher
<p>Hi,</p>
<p> </p>
<p>You can use the CONCATENATE function in an aggregation component to add together values from multiple rows. Let's say you have the following join:</p>
<p> </p>
<div>
<pre class="_prettyXprint _lang-sql">
select c.customername
, o.ordernumber
from customers c inner join orders o
on c.customernumber = o.customernumber
</pre>
<p>In a table using this query, group by CUSTOMERNAME, then create an aggregation using the following definition:</p>
<p> </p>
<p>
ArK
<p>Thanks for your reply!</p>
<p> </p>
<p>Unfortunately I might have over simplified my problem as I was only trying to convey the concept. The actual values I'm dealing with are numeric and I need to sum them in a crosstab. The column dimension contains certain categories and the rows would have numeric values to be summed. The rows, though, don't hold these values in the DB but they need to be added to the data set via the extension table.</p>
<p>There are a few different extension tables and some of them only show WHERE the values can be found...the values are always in an extension table but one might point to another. There are lots of dynamically added values here so I figured that collecting them in a variable and then adding them to correct data sets might be the way to go.</p>
<p> </p>
<p>-Arto</p>
pricher
<p>Hi,</p>
<p> </p>
<p>You can use the onFetch method of the data set to add or modify the value of a column. The syntax is simply:</p>
<pre class="_prettyXprint _lang-js">
row.myColumn = <value>
</pre>
<p>where myColumn is either a column in your query or a computed column added to your data sets.</p>
<p> </p>
<p>The onFetch method is called for each row returned by the query.</p>
<p> </p>
<p>Hope this helps,</p>
<p> </p>
<p>P.</p>
ArK
<p>Hi,</p>
<p> </p>
<p>I also thought of something like this, but how can I make sure that the variable (extensions) are fetched before I reference them in the other data set? </p>
<p> </p>
<p>Is there a way I can define the order in which the data sets are fetched? I tried adding a bound element to the top of the report, but the other data set is fetched with parameter values so I'm guessing it will be fetched first anyway?</p>
<p> </p>
<p>-Arto</p>
pricher
<p>Hi,</p>
<p> </p>
<p>As you have found out, the order in which the data sets are executed is based on when their results are needed in the report design.</p>
<p> </p>
<p>P.</p>