logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Sujeet Kumar T  
#1 Posted : Thursday, September 5, 2019 1:40:04 PM(UTC)
Sujeet Kumar T

Rank: Newbie

Groups: Registered
Joined: 8/12/2019(UTC)
Posts: 6
India
Location: Hyderabad

Thanks: 2 times
Hi All,

I am unable to get subtotals on TOP in single row, can anyone suggest me on this.

RAW DATA:

ID|| MASTER GROUP NAME || GROUP NAME || LINE || BALANCE||
--------------------------------------------------------------------------------------------------------------------||
1 ||TOTAL LOANS and ADVANCES (sum 2-4)||1 TOTAL LOANS and ADVANCES (sum 2-2.5) || || 15 ||
2 ||SHORT TERM (sum 2.1-2.13) || ||2.1 Int trade || 1 ||
2 ||SHORT TERM (sum 2.1-2.13) ||2.4 International trade (sum 2.4.1-2.4.2) ||2.2 Export || 2 ||
2 ||SHORT TERM (sum 2.1-2.13) ||2.4 International trade (sum 2.4.1-2.4.2) ||2.3 Import || 3 ||
2 ||SHORT TERM (sum 2.1-2.13) ||2.5 Building and construction (sum 2.4.1-2.4.4)||2.4 TRADE || 4 ||
2 ||SHORT TERM (sum 2.1-2.13) ||2.5 Building and construction (sum 2.5.1-2.5.4)||2.5 Commercial || 5 ||


EXPECTED OUTPUT:

ID|| MASTER GROUP NAME || BALANCE ||

1 ||TOTAL LOANS and ADVANCES (sum 2-4)|| 15 ||
2 ||SHORT TERM (sum 2.1-2.5 ) || 1 ||
3 ||2.1 Agriculture || 2 ||
4 ||2.2 Manufacturing || 3 ||
5 ||2.3 Domestic trade || 4 ||
6 ||2.4 Int trade (sum 2.4.1-2.4.2)|| 5 ||
7 ||2.4.1 Export || ||
8 ||2.4.2 Import || ||
9 ||2.5 Hotel & tourism || ||

As this is the requirement from client, expecting a quick reply.

Thanks & Regards,
Sujeet


















epf  
#2 Posted : Monday, September 9, 2019 6:25:38 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 205 time(s) in 198 post(s)
Hi, your sample is not very clear, can you do it with Northwind ?
Sujeet Kumar T  
#3 Posted : Friday, September 13, 2019 5:29:23 AM(UTC)
Sujeet Kumar T

Rank: Newbie

Groups: Registered
Joined: 8/12/2019(UTC)
Posts: 6
India
Location: Hyderabad

Thanks: 2 times
In below link we have uploaded my output image.

https://ibb.co/KLs1sDJ

Thanks
Sujeet

Edited by user Friday, September 13, 2019 9:09:15 AM(UTC)  | Reason: Not specified

Sujeet Kumar T  
#4 Posted : Monday, September 23, 2019 5:25:52 AM(UTC)
Sujeet Kumar T

Rank: Newbie

Groups: Registered
Joined: 8/12/2019(UTC)
Posts: 6
India
Location: Hyderabad

Thanks: 2 times
Hi Epf,

I am waiting for your response, Kindly suggest the solution asap.

Thanks
epf  
#5 Posted : Tuesday, October 1, 2019 9:20:02 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 205 time(s) in 198 post(s)
Yes, here is a solution to have the Subtotal on top:
Select your model and modify the 'Final Script' property to reorder the ResultTable Lines (Rows).
The script will look like:

Code:
@using Seal.Model
@using System.Data
@{
    ReportModel model = Model;
 	ReportExecutionLog log = model.Report;

    //Final script executed to modify the model result tables after their generations
    //Note that other assemblies can be used by saving the .dll in the Repository 'Assemblies' sub-folder...
    log.LogMessage("Modifying result values with the 'Final Script'...");
    ResultTable summaryTable = model.SummaryTable;
    foreach (ResultPage page in model.Pages)
    {
        ResultTable table = page.DataTable;
        
        var newLines = new List<ResultCell[]>();
        for (int row = 0; row < table.BodyStartRow; row++)
        {
            newLines.Add(table.Lines[row]);
        }
        
        int firstRow = table.BodyStartRow;
        for (int row = table.BodyStartRow; row < table.BodyEndRow; row++)
        {
            if (table.IsSubTotalRow(row)) {
                newLines.Add(table.Lines[row]);
                for (int row2 = firstRow; row2 < row; row2++) {
                    newLines.Add(table.Lines[row2]);
                }     
                firstRow = row+1;
            }                    
        }
        
        for (int row = table.BodyEndRow; row < table.RowCount; row++)
        {
            newLines.Add(table.Lines[row]);
        }
        
        table.Lines = newLines;
    }

}


In attachment is the sample report to do this.
Subtotal on top.srex (13kb) downloaded 2 time(s).
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.