Dynamic linking of Two Tables

Dear Friends,

Help me with this scenario…

I have two tables, suppose Table A & Table B.

Table A has 8 fields and Table B has 4 fields that are present in table A, but with different names. i.e.,the 4 fields in Table B refer to 4 fields in Table A but they are mentioned with different names in Table B.

Now when I make modifications in Table A, the corresponding fields(the fields which are in different names) in Table B also should get modified and when I modify in Table B and click a Save Button, it should get reflected in Table A also.

Please help me friends…!

Hi Martin,

You can use map in this scenario.

The best approach is to normalize the tables and avoid such updates at all. Keep the fields in one table and refer to record from the other table, or extract the fields to a separate table referred by both table A and table B.

If you really have to keep the data duplication by some reason, ensure yourself that you maintain data consistency as an atomic operation, i.e. in a transaction. You can set new updates values to A in B’s update() method and vice versa. You may also want to do something in insert() and delete() methods.

Thank you friend…!

Thank you so much sir.