Cascading TableControls

To find materials quickly I have sorted them in categories. The form displays 5 TableControls in a cascading relationship. Works as expected but want to improve it.

What I want is

  1. Highlight the item selected in the TableControl
  2. Have the TablesControls further down the cascade empty, only showing entries in the following one.

What I have working
5 tables with relationships each containing 3 Fields “CATcode2, CATcode1, CATname2”. The first field is the PrimaryKey, the second relates to the previous table

Mainform and 4 Subforms each containing one TableControl

Form with 5 TableControls cascading but all filled when opening the form linking the 1st entries of each Table. But the entries are correct related.
The TableControls are linked in FormProperties (Link master fields, Link slave fields)

Sorry, new users can only upload one image.

Thanks for suggestions

For highlight: You will need the record marker on the left.

The tablecontrols will be linked by form → subform → subsubform … Don’t see a way to disable showing a value in subsubform, if there is a value in subform. Would only work with macros, where I would prefer to set all other tablecontrols invisible.

Thanks RobertG! Indeed when I show the RecordMarker a little arrow indicates the selected record. Would like something a little more obvious.
Make the control invisible might be a way forward. I put a rectangle of the same size and background colour behind the TableControl. If the TableControl is set to invisible the area is still marked but without data. The makro for table 2 would have to switch on click table 3 to visible and tables 4 and 5 to invisible. Do you have a suitable makro?

Hints for a macro:

Macro should be started when row has been changed in a form. Form could be detected by event.

oForm = oEvent.Source
arForms = array( "frmTwo/frmThree", "frmTwo/frmThree/frmFour", "frmTwo/frmThree/frmFour/frmFive")
	FOR i = 0 TO UBound(arForms)
		arFormNames = split(arForms(i),"/")
		SELECT CASE UBound(arFormNames)
			CASE 0
				oFormTarget = oForm.getByName(arFormNames(0))
			CASE 1			
				oFormTarget = oForm.getByName(arFormNames(0)).getByName(arFormNames(1))
			CASE 2			
				oFormTarget = oForm.getByName(arFormNames(0)).getByName(arFormNames(1)).getByName(arFormNames(2))
			CASE 3			
				oFormTarget = oForm.getByName(arFormNames(0)).getByName(arFormNames(1)).getByName(arFormNames(2).getByName(arFormNames(3))
		END SELECT
		FOR k = 0 TO oFormTarget.Count - 1
			oField = oFormTarget.getByIndex(k)
			IF oField.ServiceName <> "stardiv.one.form.component.Form" AND  oField.ServiceName <> "stardiv.one.form.component.Hidden" THEN
				IF boLeader = True THEN
					oField.EnableVisible = True
				ELSE
					oField.EnableVisible = False
				END IF
			END IF
		NEXT
	NEXT

It’s a part of a form where I am just creating. So there is a boolean variable to switch between visibility (EnableVisible = True) and hidden elements. Change this to what you need.

Will see if I could change the example from @Villeroy to work like you expected.

All forms are part of an array. The array contains all values when starting clicking on first tablecontrol.
countries_cities.odb (75.8 KB)
Try “Forms Cascade” by clicking with the mouse.

The sample odb shows what I have now. The macro - well I have to improve my understanding, will take a little.

@Yumi : Did you realize the form works with the macro in the example I have added? It is the example from @Villeroy , but the third tablecontrol will only be shown when a value in second tablecontrol is choosen.

No, I did not. What I thought is that I have to understand the macro and change names of forms and controls. But I will have a go.
Here I upload my database. Category 4 and 5 are set to invisible. Dark grey are only rectangular place-holders. Some data has been entered in “Prosthetics” and “Equipment”.
OTdata_oxperimental (copy).odb (24.4 KB)
What I am trying to do is to demonstrate that a user is able to access the right category out of a theoretical of 10000 with only 5 clicks. The real programing has then to be made by professionals. And my improvements aim to make it easier for the user. After all we should be able to make good artificial limbs and are no computer-freaks (at least not all of us :wink:)

OTdata_oxperimental (copy).odb (26.1 KB)
Hope this is what you expected.

Can’t see any difference to the version I uploaded. What have you changed?

Have you allowed LO to execute macros? The open the form. Click on “Category1”. Tablecontrol of third form disappears, because it hasn’t been set as invisible at start.
Click on “Category2”. Will show “Category3” and content in this “Category3”, if chosen the first values in “Category1” and “Category2” … and so on.

If you don’t see any difference you haven’t allowed LO to execute macros for the database file.

Thanks, I am learning due to good advice.
I upload a image which shows what I want to achieve. From the 4 lines (should be 5) only one is visible at the time. Second line shows what happens if I select “Upper limb” in the first line. Basically it makes the next tableControl visible and so on. My highlighting of the selection a l bit weak, should be more obvious.
4lines2

Highlighting is part of the theme you are using. Will depend on the window manager you are using.

RobertG, I can confirm that your macro is working as intended. Not at first but with a little persistence. In the meantime I extended the functionality by selecting a record in TableControl5 displays single products with image.
Marked as Solution.
But I do not want to be the one who fills in all the 10000 possible categories :wink:.

Just for those who want to see the function here my demo database:
OTdata_oxperimental.odb (314.4 KB)

A table control has no data. A table control is a bundle of other controls (text, list box, date control etc.).
Use the form navigator to create a hierarchy subforms and link them by their respective keys.

Form1
TableControl1
→ Form2
→ TableControl2
-----> Form3
-----> TableControl3

See “Forms Cascade” in the attached document:
countries_cities.odb (74.6 KB)

Thanks. I looked at your examples and this is basically what I got now. Want to refine and clarify the functionality a little for the visiting user.

To highlight a selected item in the table control you can change the background colour

Thanks, that would be very obvious indeed. But how to do it?

Place the form in edit mode, doubleclick the control and in the properties scroll down to background colour and change it there.

I meant to highlight one selected record in the TableControl, not the background of the whole control.