Friday, November 16, 2012

CSV files with ADF CSVParser Example.

Hi all,

This is a small example on how to use a CSVParser which comes along with ADF.

oracle.adf.model.adapter.dataformat.csv.CSVParser;


We are going to create a small example using a csv file.

The project can be found in the following repository:
ADFCSVParserExample
https://github.com/mox8iro/ADF-SamplesR2


We are going to use a simple csv file and we are going to upload it, parse it and create rows in the corresponding view object.

with the use of CSVParser, things are a bit more easy. Just follow the screens below and you will understand why.
First, we have to create a project.. We will work on a simple project based on HR Schema.
We will the af:inputFile component for this example. In the value Change Listener we write the following:



as you can see above, the parse calls the createRow method through the bindings. it is not the default adf operation.  it is a custom method:


and then we expose it to the client interface.

add it in the bindings as a method action.


 place the appropriate partial Triggers from and have the inputfile autoSubmit true and here it is!
in the below screen shot



Aaaand that is it! Simple isnt?

The project can be found in the following repository:
ADFCSVParserExample
https://github.com/mox8iro/ADF-SamplesR2

References:
http://technology.amis.nl/2007/07/15/uploading-csv-files-into-dynamic-adf-faces-tables-programmtically-creating-columns/

http://technology.amis.nl/2010/09/16/adf-11g-import-from-excel-into-an-adf-table/


Regards.

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...