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;
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).
Drag and drop it and it will ask for the Iterator name which we want to update;
We select the iterator name using the Expression Builder;
And this is how it looks, like a normal uploadFile component;
Now running the page;
Selecting a file (note: the header row should match exactly the attribute names of your viewObject in order for this to work properly);
Opening the file;
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.