3 Replies Latest reply: Mar 25, 2013 12:13 AM by 991535 RSS

    how to calculate sum(discount) when check box status ='Y'

    991535
      Hai.
      This is Venkatesh i want sum(disc) of particular items when check box STATUS='Y'
      I Selected data from quota_det TABLE

      i have 5 items codes
      SNO ITEM ITEMCODE QTY PRICE             BASIC DIS_PER              DISC STATUS

      1. DELL D26OO 2 30000 60000 5 57000 Y

      2. HP HP2300 1 20000 20000 2 19600 N

      3. SAMSUNG SM560 2 5300 10600 3 10282 N

      4. NOKIA NK63 5 25600 128000 3 125440 Y

      5. HTC HT25 1 2300 2300 2 2254 Y


      ALL ARE DATABASE ITEMS BUT STATUS IS NOT A DATABASE ITEM THAT IS CHECK BOX ITEM

      VALUE WHEN CHECK=      Y
      VALUE WHEN UNCHECK=  N

      IN ABOVE DATA I WANT ONLY SELECTED ITEMS SUM(DISC) WHEN CHECK BOX ITEM CHECK THAT SUM MUST BE APPEAR IN TOT_VALUE* ITEM*

      PLEASE SEND CODE FOR ABOVE REQUIREMENT WITH TRIGGER NAMES ITS URGENT...

      Edited by: 988532 on Mar 22, 2013 10:27 PM
        • 1. Re: how to calculate sum(discount) when check box status ='Y'
          HamidHelal
          988532 wrote:
          Hai.
          This is Venkatesh i want sum(disc) of particular items when check box STATUS='Y'
          I Selected data from quota_det TABLE
          i have 5 items codes 
          *SNO*              *ITEM*                    *ITEMCODE*    *QTY*      *PRICE             BASIC*          *DIS_PER              DISC*             *STATUS*
          
          1.                      DELL                       D26OO             2              30000             60000                5                    57000              Y
          
          2.                      HP                          HP2300            1              20000             20000                 2                   19600               N
          
          3.                    SAMSUNG                  SM560              2              5300               10600                3                   10282               N
          
          4.                      NOKIA                     NK63                5             25600               128000              3                  125440              Y
          
          5.                      HTC                        HT25                1             2300                  2300                 2                  2254                 Y
          ALL ARE DATABASE ITEMS BUT STATUS IS NOT A DATABASE ITEM THAT IS CHECK BOX ITEM

          VALUE WHEN CHECK=      Y
          VALUE WHEN UNCHECK=  N

          IN ABOVE DATA I WANT ONLY SELECTED ITEMS SUM(DISC) WHEN CHECK BOX ITEM CHECK THAT SUM MUST BE APPEAR IN TOT_VALUE* ITEM*

          PLEASE SEND CODE FOR ABOVE REQUIREMENT WITH TRIGGER NAMES ITS URGENT...

          Edited by: 988532 on Mar 22, 2013 10:27 PM
          Welcome to the Oracle Forums. Please take a few minutes to review the following:

          <ul>
          <li>Oracle Forums FAQ
          <li>Before posting on this forum please read
          <li>10 Commandments for the OTN Forums Member
          <li>How to ask questions the smart way
          </ul>

          Following these simple guidelines will ensure you have a positive experience in any forum; not just this one!

          You post in wrong forum. please post at {forum:id=75} and close this thread marking as answered.

          If someone's response is helpful or correct, please mark it accordingly.*

          Edited by: HamidHelal on Mar 23, 2013 1:06 PM
          • 2. Re: how to calculate sum(discount) when check box status ='Y'
            XeM
            Hi Venkatesh!

            You could try this!

            Make one other text item something like disc_copy item between disc and status on the same block
            set below properties for this text item
            1. Database item: No
            2. Data type: Number
            3. Canvas: Null

            Create One other text item like total_discount set below properties

            1. Database item: NO
            2. Data type: Number
            3. Calculation mode: Summary
            4. Summary Function: Sum
            5. Summarized Block: YourBlock
            6. Summarized Item: disc_copy

            If you are block is multi record block then
            7. Number of Items Displayed: 1

            Set YourBlock property
            Query all records: Yes

            Now, on status item apply WHEN-CHECK-BOX-CHANGED trigger and write below code in this trigger
            if :YourBlock.status='Y' then
                 
                 :YourBlock.disc_copy:=:YourBlock.disc;
            else
                 :YourBlock.disc_copy:=0;
            end if;
            Edited by: XeM on Mar 23, 2013 12:06 AM

            Edited by: XeM on Mar 23, 2013 12:07 AM