Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Avoid repetitions
AxelB
<p>Hi,</p>
<p>assuming I have a data set table like this:</p>
<p>ID Timestamp State</p>
<p>1 2017-06-03 New</p>
<p>1 2017-06-04 Started</p>
<p>1 2017-06-08 Ongoing</p>
<p>1 2017-06-24 Solved</p>
<p>2 2017-05-01 New</p>
<p>2 2017-07-25 Started</p>
<p>2 2017-07-31 Ongoing</p>
<p>3 2017-04-17 New</p>
<p>3 2017-04-25 Started</p>
<p>4 2017-06-01 New</p>
<p>4 2017-06-01 Started</p>
<p>4 2017-06-05 Ongoing</p>
<p>4 2017-07-14 Solved</p>
<p> </p>
<p>But I only want to see the latest entry (ID & State) before a certain key-date.</p>
<p>Assuming, keydate is 2017-06-30</p>
<p>I would like to see the following result in the data set preview:</p>
<p>ID Timestamp State</p>
<p>1 2017-06-24 Solved</p>
<p>2 2017-05-01 New</p>
<p>3 2017-04-25 Started</p>
<p>4 2017-06-05 Ongoing</p>
<p> </p>
<p>Is there a smart way to get this implemented?</p>
<p>The Data Set is bound to a Dynamic Text Field. I only see to run through the complete list in 'On Fetch' and just store the latest entry for an 'ID'. But maybe there is a more smarter way to get this solved already on data set level.</p>
<p> </p>
<p>Thx</p>
<p>Axel</p>
<p> </p>
Find more posts tagged with
Comments
shamo
<p>What I will do will in the query will be to use max(timestamp) over ( partition by Id order by id asc) as newname</p>
<p> </p>
<p>then will use a filter like timestamp = newname. this will give you the results.</p>
<p> </p>
<p>Hope this helps</p>
AxelB
<p>Hi Shamo,</p>
<p>thanks for the input, I understand what you're intention is.</p>
<p>But I'm failing on the implementation part.</p>
<p> </p>
<p>I'm working with BIRT in Eclipse. I've now added a ComputedColumn 'Newname' with Expression 'row["TIMESTAMP"]' and Aggregation ='MAX'.</p>
<p>But this leads to that every entry gets the same timestamp.</p>
<p> </p>
<p>I cannot simply transfer this SQL expression "max(row["TIMESTAMP"]) over ( partition by row["ID"] order by row["ID"] asc)" to the Expression Builder?</p>
<p> </p>
<p>Thx</p>
wwilliams
<p>I believe Shamo was suggesting that you use that in the open of you data set e.g.</p>
<p>maximoDataSet = MXReportDataSetProvider.create(this.getDataSource().getName(), this.getName());<br>
maximoDataSet.open();<br><br>
var sqlText = new String();<br><br>
// Add query to sqlText variable.<br>
sqlText = "SELECT max(timestamp) over....</p>