I'm facing a situation where I have to handle entity instances in a different way. This is how it should look:_ Page number n: Enter the number of people (Let input = k) Page number n+1: Enter the details of person 1 of k Page number n+2: Enter the details of person 2 of k Page number n+3: Enter the details of person 3 of k
... Final screen: Enter the details of person k of k
Top goal is related to some of the 'details'. How do I implement this?
1) Total number of instances is fixed. User is allowed to add exactly k instances, where k is the input in the n ^th^ screen
2) Each instance is to be collected in a new page - I'm calling it 'page' because it is not the same as 'screen'. Page n+1, n+2, n+3, ... together form an entity screen.
Edited by: 953039 on Aug 15, 2012 10:20 PM
It depends a little bit on what specifically you want to do.
If you want the user to enter a number (say 3) on page n, and then want 3 instances to be automatically created by OPA which the user can then manipulate by filling in base attributes... you won't be able to do this out-of-the-box. In 10.4, inferred entities cannot contain base attributes. You could achieve this functionality by implementing a custom inferencing listener (Java or .NET).
There used to be a great example in the developer help (http://docs.oracle.com/html/E36316_01/toc.htm) about creating an inference listener but I can't seem to find it online (it showed how to implement pretty much exactly the functionality you describe). I have a local copy in the 10.3 help so post back if this is the functionality you are after and I can paste it in here.
Instead of the number field, you could have an entity collection screen where the user clicks the Add Instance button 3 times and initially just fills in a name for each person, then they visit a details screen for each instance afterwards (this is a quite common approach). If the user is restricted by the number of instances they can enter, you can use an Error() event rule to stop them entering more than the required number of instances.
I may have mis-understood your requirements but if you want to dynamically create instances from a number field, and then input base attributes into them, you won't be able to do it out-of-the-box.
Thank you for replying.
As you had mentioned, one way of doing this is by collecting primary information as entity instance in one screen, and then collect other details in a new screen - appears as new 'page' for each person.
However, the specification is strict and has to be implemented at any cost. I'm trying to stick to it.
My goal is to allow the user to enter the number of people in one screen. Then I have to collect information about each person in new 'page'. The number of 'pages' should be equal to the number of people (input).
I haven't marked this question as 'answered' yet. I'm expecting a complete solution. Someone (someone I know) mentioned the term 'addinstance' offhand, but I'm unable to find the syntax in the function reference. Can someone help me out with this?
I believe this is the sample Ben is pointing at http://docs.oracle.com/html/E27555_01/toc.htm (OPA 10.3.1 docu) where a number attribute is used to generate the number of entity instances.