Difference between revisions of "Reference Table with Dynamic Validation"
From ADempiere
This Wiki is read-only for reference purposes to avoid broken links.
m (→Steps) |
m (→Steps) |
||
Line 13: | Line 13: | ||
*The table is selected here and the field chosen is the ET_Departure which becomes distinct origins during pull down. | *The table is selected here and the field chosen is the ET_Departure which becomes distinct origins during pull down. | ||
− | + | *You can see the result from the following screen. | |
+ | [[Image:PulldownReference.png]] | ||
+ | *It shows all the available origins that the user can choose from. | ||
+ | *Now we shall do the same for the other field which concerns destinations or arrivals. | ||
[[Image:ReferenceTable2.png]] | [[Image:ReferenceTable2.png]] | ||
Revision as of 03:45, 23 May 2009
Case Study
- We are doing this as a prototype for an E-ticketing system.
- We are going to create a Reference to a Table in the database.
- The Reference are created for the field ET_TripBegin and ET_TripEnd from table ET_Booking. They will access the Table called ET_Vehicle
Steps
- The ET_TripBegin field Reference is set to Table instead of String. A new Reference 'Departures' is created. You can do that on the fly by right-clicking on it and select Zoom.
- The table is selected here and the field chosen is the ET_Departure which becomes distinct origins during pull down.
- You can see the result from the following screen.
- It shows all the available origins that the user can choose from.
- Now we shall do the same for the other field which concerns destinations or arrivals.
- This second field ET_TripEnd will refer the same table. Note that it has an extra duty under Dynamic Validation.
- The pull down will show all the arrivals. But we do not want all of them. We just want those that correspond to the origin.
- Dynamic Validation allows for SQL injection, where we supply the WHERE clause.
- Here we ask it to access the ET_Vehicle table for records similar to the origin by ensuring similar ET_Departure values.
- @..@ traps the field value in play. We place it within single quotes '@..@' for SQL to take it as a string value.