5 Replies Latest reply: Feb 18, 2010 11:24 AM by 551485 RSS

    Bi PUblisher conditionally return a section of report

    589871
      I've created a report template and want to conditionally return a block (table section) in side this report. Could some one tell me the syntax for this or is there some sample code somewhere? Is it placed <?for-each:Group?><?end for-each?>?
        • 1. Re: Bi PUblisher conditionally return a section of report
          712652
          Hi,

          I guess it should be within an if tag or a choose tag

          Replace the bold with the condition

          1) Using if - acts like the if statement in ordinary programming lang

               <xsl:if test="*string-length(.) != 0* ">

          Display  Table

          </xsl:if>

          2) Using Choose - acts like the if else statement in oridinary programming lang

          <xsl:choose>                                             
                                                                 
                    <xsl:when test="*string-length(.) != 0* ">

          Display  Table

          </xsl:when>
          <xsl:otherwise>

          Display Custom message

          </xsl:otherwise >
          </xsl:choose>

          Hope this helps

          Regards
          XS

          Edited by: user10979469 on Dec 16, 2009 12:51 PM
          • 2. Re: Bi PUblisher conditionally return a section of report
            589871
            I tried the example you suggested on the group property of the section of the report I wanted to conditionally return and it did not work. This is the code I used:

            <?for-each:G_VOUCHER?>
            <xsl:if test="VENDORREMITTTOHOLD != 'x' ">
            Display Table
            </xsl:if>
            <?end for-each:G_VOUCHER?>

            I'm not sure if I'm in the right place to use this code. I'm relatively new to BI PUBLISHER and I appreciate your assistance.
            • 3. Re: Bi PUblisher conditionally return a section of report
              524753
              <?for-each:G_VOUCHER[./VENDORREMITTTOHOLD != 'x']?>
              
              Display Table
              
              <?end for-each:G_VOUCHER?>
              Make sure
              VENDORREMITTTOHOLD element is a child of G_VOUCHER , or use the relative path for this element.
              • 4. Re: Bi PUblisher conditionally return a section of report
                551485
                Vetsrini,

                What if I wanted to evaluate 'x' using a variable (in my example replacing '17'). What might the syntax be? I tried so many different ways, just not getting it.

                Say I have this Separate Remittance report: I want to exclude any checks that have less than 18 invoices per check. I don't want to use 17 as a hard coded value. v_inv_count does in fact return 17 as I have it in my output at the G_SEL_INV_DATA level. I see it in the output. But I want to use this variable to help determine if the section should be displayed.
                --The below returns what I want.
                <?start:body?>
                <xsl:variable xdofo:ctx="incontext" name="v_inv_count" select="/APXPBSRA/C_INV_PER_STUB"/>
                <?for-each@section:G_SEL_CHECKS[./C_INV_PER_CHK > '17']?>
                <?for-each:G_SEL_INV_DATA?>

                <?end for-each?>
                <?end for-each?>
                <?end:body?>

                Thanks,
                AG

                Edited by: OSUBeavers on Feb 15, 2010 3:53 PM

                Edited by: OSUBeavers on Feb 15, 2010 3:55 PM
                • 5. Re: Bi PUblisher conditionally return a section of report
                  551485
                  I figured it out.