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)
Display a value of the second row of a select
Ulf
I have a select statement which returns always three rows. in an overview i need a value of the second row. the value of the first and third row i got with the help of a computed column and the aggregation first / last. How can i display the second value? (no detail colomn because i need the value in a single data field)
Find more posts tagged with
Comments
mwilliams
Are you just needing to get access to the second value in your report design? If so, in your initialize method, you could set a variable to zero and another variable to store the value in, i.e. i=0; secondValue=0;. In you onFetch script of your dataSet, you could then say, if (i == 1){secondValue = row["dataFieldName"]; i++;} else{i++;}. Then you could just recall the value in a dynamic textbox in your report with secondValue;
Hope this helps.
Hans_vd
An alternative solution could be this:<br />
<br />
1. Add a column to your table and put a data item in it<br />
2. create an expression in the data item like this:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>if (row.__rownum == 2) {
row["YOUR_COLUMN"];
}</pre>
3. Add an MAX aggregation in the overview on this data item to get the value<br />
4. Hide the table's column by setting the visibility property<br />
<br />
Hope this helps<br />
Hans
Hans_vd
Hm, now that take a better look... less different than mwilliam's solution as I first thought.
And probably more work to be done too :-)
Ulf
thank you for your help. with the help of the following expression i got one result of the second row.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>if (Total.runningCount () == 2) {
dataSetRow["(expression)_14"];
}</pre>
<br />
this i tried for other values in the same dataset but it didnt worked any more. i got he same value although i used another column.<br />
<br />
The method of mwilliams seem to be to complicated. <br />
<br />
For lack of time i created another stored procedure which just returns the second and third row so that i can use the last / first feature
mwilliams
Here is a report that actually implements what I posted if you want to take another look. It's very simple script.