getting the value of a column that not related to your database block have many various methods , ( post query code - block on joing - function based column source )
consider a asituation that you want to display the the dept name in your employees block , the old fashion and not efficient way is to write a select statemnt in Post-query trigger of your block using the value of the emp.deptid bind variable in your form , this way in this situation is not effecient as it make round tirp to the database to get the dept name , also you can suppose that the business requirement arisen to not display the deptname only , it needs to display 'deptname-deptlocation' , in this situation you will change all modules that display this field !!!!!!!
the most effecient way to display the dept name is to make a database function that have argument deptid and return the deptname ,
after that you can create a field in your emp block and change its property database to yes and its column source name to "your function name " , this will erase any roundtrip to the database in your post query trigger , also you can change the output of the function according any new business requirement , also you will write the code once and use it many times
--- block on join
suppose that you want to display 9 or more columns from the dept table with your emp table ( block on join will be the effecient way )
implementation of the block on join
- create your emp block
- create your other columns you need
- change the column source name of the emp block to 'emp,dept'
- change the source column property for your added column to the corresponding database column name ( don't forget prefex with table name)
- change the property of your emp blcok primary key to primary key - yes
- change the property query only , update allowed , insert allowed to yes, no , no respectively of your added columns
- change the properry " dml target name " of your block to 'emp'
run your form to show the result
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment