In this post, I will be describing how to use Model driven LOV Switcher.
Sample Use case 1:
Say, user can choose whether he has to search the data using Regions or Countries.
So, You have a check box with values Country or Region.
If user selects Country, We have to show Countries LOV and
if the user selects Region, We have to show Regions LOV.
So, there are many ways to do this. The usual way is having two attributes in VO and having LOV's defined on them. Conditionally rendering them on the UI based on the selected value.
But, this is not required. With one VO attribute itself we can do this using LOV switcher.
Sample Use case 2:
We have a EO Based VO, We have to store either country or Region in the DB table based on the selected value. So, we use LOV switcher here to implement this case also just as above.
Demo:
1. Create two read-only VO's based on Countries and Regions from the HR Schema.
2. Create a transient VO having two attributes.
3. Create a static VO having two values, Country and Region.
4. Create List of values on the Filter attribute pointing to Static VO and select Boolean radio group in the UI hints.
5. Create an LOV for SearchBy Attribute pointing to the CountriesVO and name the LOV as country. By clicking on the + again, we can create one more LOV for the same attribute. Now create it on RegionsVO.
This automatically creates a LOV switcher.
6. Choose the List of Values Switcher to Filter attribute. (It means, we are going to swith the LOV's based on value of filter attribute). Shown in above screenshot.
7. Now, drop the Filter attribute on UI as radio group and drop the SearchBy attribute as Select one choice. Put auto submit property true on the Radio group. Put partial trigger on the SelectOneChoice to Radio group.
Now, When you select Country in radio group. Countries LOV will be shown, else Region LOV will be shown.
Hope this helps :)
The filter and searchBy attribute are visible only when we add a createInsert button and click it. Is there any other way to make the attributes visible?
ReplyDeleteDid u use a programmatic VO to display the LOV's??
ReplyDeleteProgrammatic VO by default doesnt hold a row, u need to create insert a row.
May be u can use a default activity in the task flow and call the createInsert method there.
There is another option too, U can use a SQL Query based read-only VO with the query as "Select '' as attr1, '' as attr2 from dual" which would hold a row. U need not call any createInsert operation here.