Search code examples
bi-publisher

Grouping based on IF condition is not working


I have a BIP report in which I have a parent group as (<?for-each-group:G_1[./TICKET_JOBNUMBER=$JobNum];./TICKET_JOBNUMBER?>) and under that I have another group that is needed to be selected based on report parameter $date. That is, I am doing following:

<?if@inlines: $date = "" OR $date = null?>
<?for-each-group:current-group();./TICKETNUM?>
<?end if?>
<?if@inlines: $date != "" ?>
<?for-each-group:current-group()[./TICKET_TICKETDATE=$date];./TICKETNUM?>
<?end if?>

But this is giving unwanted output. I want each <?for-each-group:current-group();./TICKETNUM?> as separate but with my IF conditions it is generating a consolidated output but not a separate record for each group.

Currently I am seeing following:

enter image description here

But it should be like this:

enter image description here

The IF conditions works if put them individually but it does not work when i put them together.

Link to download rtf and sample xml.

https://drive.google.com/file/d/1e6h6ENsGzjB7Gfzp6vqDlbddREWitS5f/view?usp=sharing https://drive.google.com/file/d/1pwMqtV5PxVmGSySbNllVDIlbK_3cdVaK/view?usp=sharing


Solution

    1. You'll want to use the @section to split pages for the new groups, when you have the correct grouping/regrouping in the correct spots.
    2. The for-each and/or for-each-group should only be in a table cell if you are going to be repeating that specific row/section. I see you have them in the first cell of the top table, that's not going to work to repeat the pages. Put them before/outside the table.
    3. You only need the current-group() if you are already in a grouping section, and you want to refer to the elements you have grouped. So it shouldn't be in the first grouping.
    4. I don't get what you are trying to do with the if statements. Generally, if you want a condition for one of the records, just put the if statement just inside the for-each/end for-each.
    5. The inlines is only if you are doing something in the middle of a sentence, and you don't want a new line after the logic. From what I can tell, you don't need it here.

    Sounds like you want something like this

    for-each-group@section:DATA_DS/G_1;TICKETNUM
    [header section and table]
    [Line]
    for-each:current-group();
    [line content]
    end for-each
    end for-each-group
    

    Hopefully that gets you going in the right direction. Seems like you have quite a few problems, so its hard to tell exactly what you want. And in the spirit of StackOverflow, I don't want to make the whole solution for you, just solve the one problem you have. The BI Publisher documentation is actually pretty good. If you run into some trouble, try starting smaller, get that to work, then grow it from there, making sure each new addition works as you add it.