How to make grouping in jasper table? My group is incorrect. Support Needed

Hi,

I write simple reports in Jaspersoft Studio for Eclipse.

I need to do a big hard report for now. In my report I have some static texts and 3 jasper tables with separate Dataset. DataSource - Json.

I was added a Group (Group is the name) section in my Info Dataset. I also was added a GroupHeader band in my table.

Json - 1-level array (not grouped) of data like this: [ { operation: "Group 1 Name", group: null, ..}, { operation: "Element 1 Name", group: "Group 1 Name",..} ..]. I want to print GroupHeader then group field = null.

Like you can see on my screen, groups are printed twice. In my DataSource I have 13 elements with 5 groups. In my result pdf I get 18 elements (because groups printed twice).

What I must change to avoid this behavior?

5

makushatnik's picture
Joined: Jan 21 2016 - 2:46pm
Last seen: 3 years 4 months ago

3 Answers:

Hi Mr. Makushatnik,

do you mean like rendering 1 row consist of grouping data only then render its group data detail below it till next group and repeat?
if so, ive done similiar case with table element.
i use column header band (column name), group header band (grouping), and detail band (other column data).
i merge all cell in group header band and put the grouping query data render there while the other column data in detail band.

example i query person group by city, preview will be :
NAME     AGE     GENDER
newyork
A     45     male
B     30     male
los angeles
C     25    female
D     55    male

hope that helps. cheer!

regards,

TV

trvpseudo's picture
1169
Joined: Jan 30 2019 - 11:02pm
Last seen: 2 weeks 1 day ago

Hi,

Thanks for your answer.

I started to do like you said. It removes duplicates in element's section, but I still have duplicate string in groupHeader band and in this section I can't see my added in Json structure and in jasper table fields - groupName.

That's my report for now (I used him like a subreport for a bigger report):

powers.jrxml

Can somebody tell me, what is wrong? 

makushatnik's picture
Joined: Jan 21 2016 - 2:46pm
Last seen: 3 years 4 months ago

I have a Json like this:

{
    "info": [
        {
            "group": "Все события",
            "groupName": "Все события",
            "operation": "Все события",
            "sms": null,
            "email": null,
            "dbo": null,
            "phone": "",
            "condition": null
        },
        {
            "group": "Системные события",
            "groupName": "Системные события",
            "operation": "Системные события",
            "sms": true,
            "email": false,
            "dbo": true,
            "phone": "",
            "condition": null
        },
        {
            "group": "Системные события",
            "groupName": null,
            "operation": "Вход в систему",
            "sms": true,
            "email": false,
            "dbo": true,
            "phone": "+79635214478",
            "condition": null
        },
        {
            "group": "Системные события",
            "groupName": null,
            "operation": "Cмена пароля",
            "sms": true,
            "email": false,
            "dbo": false,
            "phone": "+79635214478",
            "condition": null
        },
        {
            "group": "Договор ДБО",
            "groupName": "Договор ДБО",
            "operation": "Договор ДБО",
            "sms": true,
            "email": false,
            "dbo": true,
            "phone": "",
            "condition": null
        },
        {
            "group": "Договор ДБО",
            "groupName": null,
            "operation": "Выпуск сертификата",
            "sms": true,
            "email": false,
            "dbo": true,
            "phone": "+79635214321",
            "condition": null
        },
        {
            "group": "Договор ДБО",
            "groupName": null,
            "operation": "Предупреждение об истечении срока сертификата",
            "sms": true,
            "email": false,
            "dbo": true,
            "phone": "+79635214321",
            "condition": null
        }
    ],
    ...
}

 

makushatnik's picture
Joined: Jan 21 2016 - 2:46pm
Last seen: 3 years 4 months ago
Feedback
randomness