Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Looping through data block items and populating other block items

mikrimouseAug 2 2019 — edited Aug 6 2019

In when button pressed trigger i have loop which need to go throug data block record and populate another block items. In the first loop i count how many records are in the data block, and that is correct.

For example.

I got 2 count_rows and  first record in sp_iznosi data block  populates items in the second data block sp_stavke, but for second record in data block sp_iznosi it doesnt even  enter into loop.

So how to loop through the second record in data block ? Thanks

go_block ('sp_iznosi');      

       FIRST_RECORD;

            count_rows := 0;

            loop

                IF :sp_iznosi.vp_sifra IS NOT NULL THEN

                    count_rows := count_rows+1;                   

                END IF;           

                if :SYSTEM.LAST_RECORD = 'TRUE' then

                    EXIT;

                ELSE

                NEXT_RECORD;

                end if;                       

            END LOOP;

                check_error(count_rows) -- here i get 2 counts

        for j in 1..count_rows -1            

  

        loop

       

            go_block ('sp_stavke');

           

      clear_block(no_validate);

    

            stavke_ukupno := 0;

         

          if :sp.datum_kraj < last_day(datum) then

              broj_radnih_sati_period := obr_raz.broj_radnih_sati(datum, :sp.datum_kraj);             

          else

               broj_radnih_sati_period := obr_raz.broj_radnih_sati(datum, last_day(datum));             

          end if;      

         

              iznos_rate := (:sp_iznosi.iznos * broj_radnih_sati_period / broj_radnih_sati);           

              :sp_stavke.iznos:=round(iznos_rate,2);

              stavke_ukupno := stavke_ukupno + round(iznos_rate,2);

              :sp_stavke.mjesec:=to_char(datum, 'yymm');

              datum := last_day(datum) + 1;          

              :sp_stavke.obracunato:='NE';             

             if j <count_rows then

                  next_record;        

             end if;

                           

        end loop;

This post has been answered by mikrimouse on Aug 2 2019
Jump to Answer
Comments
Post Details
Added on Aug 2 2019
2 comments
6,413 views