cascading deletes are handled automatically within the UI when set up, but are not handled for child (and grandchild, etc.) entities not present in the UI
the RI rules for deletes based on "restrict" (don't allow a delete where a cascade would delete a child based on a given relationship) are not specified in the DDL, so these also would have to be handled elsewhere. Normally using triggers.
Q:
Is it possible to establish a child parent relationship between sections of two pages?
A:
No. Sections belong to one page.
Q2:
If my project has many apps and there are a number of common pages or sections, may I know the best practice to keep the common pages /sections in sync when a change is made in the base copy of the page /section?
A2:
Everything is data bound, when switching between pages the pages are refreshed unless the "Refresh when activated" attribute is unchecked.
When you have a page visible this has a data view which consists of all of the UI elements in the page.
When Navigating between pages the data view is refreshed so you see the latest data. This is fundamental to the Lianja meta framework for building apps.
Q3:
So If I want to use the same data on a new page, should I save the index field to a memory variable and filter the table on the new page/section to get the same record data or is there a better way to link two sections. Basically I am choosing an address record from one page and starting an invoice with the same record on a new page by saving the data memory variables.
A3:
If the sections are bound to the same data, navigating between pages will do that automatically. There is no need to save anything in any variables.
Q4:
I have both sections one on the first page and the other on the second page pointing to the same database and table. When I go to the second page, it is not point to the same record in the table. Almost like it needs a parent - child relationship.
A4:
parent child relationships are not done across pages which each have their own dataview.
You will need to position on the active record in the activate delegate.
Hint: Look at using
Code:
Lianja.showdocument("page2.section1?action=search& text=" + yourkeyexpression)
in the activate delegate for page2 to keep them in sync.
If you were really doing parent/child with grids, and they were on separated pages, there is a way to do that also.
If you are using views, you would set the WHERE of the child page to the PK value of the parent record, when Activating the page.
If you are using table, you would set the FILTER of the child page in the same way.
If both cases you would use a macro expression, like so:
In desktop apps, even in JavaScript, resetting the WHERE in the Activate of the child section is all you need to do to refresh the child.
Code:
Lianja.get("pgChild.scChildGrid").where = Lianja.get("pgChild.scChildGrid").where
add the semi-colon for JavaScript.
Q:
In a Parent - child relation, do I need or can I use a subrogate key? How Lianja handles when a key like a Customer ID is change in the parent record? Will that field be changed in all child tables?
A:
When you connect sections together using the relationship builder, Lianja uses heuristics to join the parent and child tables. If the columns it chooses for the relationship do not have an index, it will create the index for you.
If that's not what you want, you edit the section attributes and change the parent-child expressions.
Note that unlike VFP, Lianja indexes do not need converting to lower or upper case when looking up keys as this is all handled internally as is trimming of the keys to remove trailing white space.
If you want to be able to break the parent-child relationship by editing the parent key, and you want to reassociate all child records to that new key, this can be done in a delegate such as the "change" delegate.
Similarly, adding new records to a child section will fill the parent key automatically.
Q:
If I have a subrogate key that relates the tables, what happen when I create a record in a child table? ia the key value added automatically?
A:
Yes the key will be added automatically as long as the child key expression is a single column.
If it is an expression then you need to handle that inside validation or an oninsert trigger.
All topics in [Answers] alphabetically:http://www.lianja.com/community/showthread.php?2717-Answers
Bookmarks