2 Replies Latest reply on Jun 13, 2013 7:26 AM by Christian Erlinger

    populate block with an sorted array contents.



      i'm trying to populate a block (forms 10 vs. db 10g) with data from an array.

      the data should be sorted.

      what is the easiest way to do it?

      another deatails (array structure)) will supplied if nessecary.


      thanks , yair

        • 1. Re: populate block with an sorted array contents.



          One way is to loop through an array and fill form's block with data from that array. If you get the data into the array form database then you should sort the data before filling the array. That way the array would already be sorted. On the other hand if you get the data into the array from some other source then there are more options. One is to use "bubble sort" algorithm to arrange the data in array. But the easiest would be to send the array to the database, sort it and read it back to the array.

          I suppose the decision has to me made based on array data source type.


          Best regards.

          • 2. Re: populate block with an sorted array contents.
            Christian Erlinger

            How do you populate your array? If you populate it with a query in some way the easiest way would be not to use an array at all and simply populate the block with your query. This would spare you manually populating the block and implementing a sort algorithm yourself (just use order by)


            If the data comes from what ever else source a pipelined function comes to my mind which would enable you to query your array with SQL and letting the SQL Engine do the sort. You'd just have to use a from-clause query on your block