1 Reply Latest reply on Dec 2, 2010 3:38 PM by SashaKeith

    CLOB data to Datagrid

    Jasonm831

      I want to display a dynamic datagrid based on a clob object from a database.

       

      The clob has data that looks like this:

       

      Network|Time|Value

      ABC|8:00 PM|2000000

      NBC|9:30 PM|123987

      FOX|10:00 AM|1235212

      ABC|7:00 PM|2000000

      NBC|11:30 PM|123987

      FOX|10:00 AM|1235212

      ABC|5:00 PM|2000000

      NBC|8:30 PM|123987

      FOX|10:00 AM|1235212

      ABC|10:00 PM|2000000

       

       

      Above is ONE clob object. All are rows that are pipe delimited. The grid needs to be dynamic because the clob object can have 3 columns at times or more or less and can contain 1 to many rows.

       

      The result should yield:

       

      NetworkTimeValue
      ABC8:00 PM2000000

       

      I am not sure how to create a dynamic data grid like this. Any help would be great.

        • 1. Re: CLOB data to Datagrid
          SashaKeith Adobe Employee

          Is there a delimeter between each row? If so, you can call split on the string, then parse each row with split("|").

           

          Create an ArrayCollection. Upon parsing the first row, you'll know the list of property names. Then for each subsequent row, you can create an Object and dynamically assign properties to it. Add each Object to the ArrayCollection using addItem. Set the Datagrid's dataProvider to this ArrayCollection.