Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » BIRT Expression to Filter Data Based on Consecutive Instances(Eclipse BIRT Tool)
BIRT Expression to Filter Data Based on Consecutive Instances [message #1868418] Thu, 18 July 2024 15:34 Go to next message
Abdul Qadeer is currently offline Abdul QadeerFriend
Messages: 2
Registered: July 2024
Junior Member
I'm working on a BIRT report and need help refining a data filtering expression.

Problem:

I have an existing BIRT template (.rptdesign) and sample XML data.
I've removed the first two columns from the report.
The goal is to display only rows where a specific value occurs 7 or more consecutive times.

Attempts:

I've created a BIRT expression but it's not producing the desired results.

Computed Column Name is *maxConsecutiveDays*, data type is *Integer*

var consecutiveDays = 0;
var maxConsecutiveDays = 0;
var lastDate = null;

for (var i = 0; i < dataSetRow["CalendarDate"].length; i++) {
    var currentDate = new Date(dataSetRow["CalendarDate"][i]);
    
    if (lastDate) {
        var diffDays = (currentDate - lastDate) / (1000 * 60 * 60 * 24);
        
        if (diffDays === 1) {
            consecutiveDays++;
        } else {
            if (consecutiveDays > maxConsecutiveDays) {
                maxConsecutiveDays = consecutiveDays;
            }
            consecutiveDays = 1;
        }
    } else {
        consecutiveDays = 1;
    }
    
    lastDate = currentDate;
}

if (consecutiveDays > maxConsecutiveDays) {
    maxConsecutiveDays = consecutiveDays;
}

maxConsecutiveDays;
Re: BIRT Expression to Filter Data Based on Consecutive Instances [message #1868430 is a reply to message #1868418] Fri, 19 July 2024 06:17 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33258
Registered: July 2009
Senior Member
It's best to ask here:

https://github.com/eclipse-birt/birt/discussions/


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: BIRT Expression to Filter Data Based on Consecutive Instances [message #1868589] Fri, 19 July 2024 21:46 Go to previous messageGo to next message
Eclipse UserFriend
555
Re: BIRT Expression to Filter Data Based on Consecutive Instances [message #1868619 is a reply to message #1868430] Sat, 20 July 2024 13:43 Go to previous message
Abdul Qadeer is currently offline Abdul QadeerFriend
Messages: 2
Registered: July 2024
Junior Member
Thank you. I have posted a question on GitHub Discussions in the Q&A category.
Previous Topic:Eclipse IDE update by sticky version
Next Topic:CSV Plugin load with Birt RE API
Goto Forum:
  


Current Time: Fri Dec 06 04:00:05 GMT 2024

Powered by FUDForum. Page generated in 0.08508 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top