FROM THE BLOG

ADF Tips: How to update a View Object using a File? UploadFile Declarative Component.

Few weeks ago someone asked about how to add new rows to a view object using a file. That person thought that ADF provided such component out of the box; a kind of  uploadFile which would give that functionality. Unfortunately for him, that component does not exists but it doesn’t mean that one, the developer, could not create one using, for instance, declarative components. 

This was done using 12.1.3. This is how it works, your declarative component will be in the form of a ‘uploadFile’ and will receive as parameter the name of the iterator you want to add new rows to. You then run your app and select a file containing the data and magic occurs. You can reuse this component across applications without any restriction. The only condition is that the file containing the data, must have exactly same attributes names than your EntityObject. You can download the project for the declarative component here: OralutionDeclarativeComponents.zip.

Now, let the screenshots speak up by themselves; please note that I won’t be showing how to create the declarative component. Detailed example can be found here. This is how you would use the declarative component in your application. This is the EntityObject which our ViewObject is based on and the one we will be updating using our new component;

adf_update_vo_using_file_1

 

After we created our container page, we proceed to drag and drop our new declarative component which is located in the Components Tab (remember to include the library to your project).

adf_update_vo_using_file_6

 

Drag and drop it and it will ask for the Iterator name which we want to update;

adf_update_vo_using_file_7

 

We select the iterator name using the Expression Builder;

adf_update_vo_using_file_8

 

And this is how it looks, like a normal uploadFile component;

adf_update_vo_using_file_9

 

Now running the page;

adf_update_vo_using_file_3

 

Selecting a file (note: the header row should match exactly the attribute names of your viewObject in order for this to work properly);

adf_update_vo_using_file_4

 

Opening the file;

 

adf_update_vo_using_file_5

 

 

And that’s all. Check your DB and see the new rows in there. Try it out with a different Iterator. This should work fine but may require small modifications to allow different attributes types.

One comment

  1. SutoCom

    on

    Reply

    Reblogged this on SutoCom Solutions.

Leave a comment

Your email address will not be published. Required fields are marked *

Social Media

Stay up-to-date with our latest ADF and related technical posts via your favourite social network services.