Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Transaction Patterns » Different Categories
Different Categories [message #4941] Thu, 27 August 2015 11:41 Go to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
Hi Tony,

did you somewhere describe or is there an example how to categorize a child record to more than one parent entry?

I have a parent child relationship where I would like to create child relationships with more than one parent. This would be a n:m relationship. The cild record should be shown each time one of the parent records are chosen.

What would be the best solution to do this? With a n:m transaction pattern? Or would it be better to create a field in the child database where all the parent keys are stored?
Re: Different Categories [message #4945 is a reply to message #4941] Fri, 28 August 2015 05:25 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
A child database table which has more than one parent is a common occurrence. If you look at RADICORE's database structure you will see several examples where a table has more than one arrow going into it.

Your statement "The child record should be shown each time one of the parent records are chosen." leads me to believe that any one of the parents should only ever have a single entry in the child table. There is no pattern for this as it does not require its own screen structure or any different behaviour. All you need do is modify the _cm_pre_getDdata() method for each parent to include a JOIN to the child table, and the data for the child will automatically be included with the data for the parent. Note that if the child table has more than one qualifying row then the result set will contain multiple rows, one for each parent-child combination.

The normal way to deal with a parent-child relationship is to start with a LIST2 pattern which has separate areas for both the parent and child entities, and where the parent entity shows one row at a time while the child entity is allowed to have multiple rows.


Re: Different Categories [message #4947 is a reply to message #4945] Fri, 28 August 2015 10:19 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
Thank you for your information but I think I haven't expressed myself very clearly. What I mean is that I want to have at leat one parent-relationship for the child occurence but I also would like to have more than one!

For your information: My child occurences are sport exercises which I can group to more than one parent exercise group. The exercise should be shown either I choose parent group A or parent group B (the child exercise has to be grouped to both of them). The only solution I see is to have a n:m relationship. Can this be a Link 1 type? If yes, do I have to create this dialog-type to create the relationships and then create a List 2 pattern to see the related childs?

I hope I expressed myself now a little bit more clearly.
Re: Different Categories [message #4951 is a reply to message #4947] Sat, 29 August 2015 05:14 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2367
Registered: April 2006
Location: Surrey, UK
Senior Member
You can relate as many parent tables to a single child table as you like. There are no limitations in RADICORE. For each parent-child combination you should use a separate LIST2 task.

When reading the child table it is also possible to retrieve one or more columns from each parent table. This is described in Using Parent Relations to construct sql JOINs


Re: Different Categories [message #4956 is a reply to message #4951] Sun, 30 August 2015 05:52 Go to previous message
htManager is currently offline  htManager
Messages: 433
Registered: May 2014
Senior Member
I will do so. Thank you for your advice.
Previous Topic: output2 with parent/child tables
Next Topic: PopUp and add1 - key fields
Goto Forum:
  


Current Time: Mon Nov 18 07:21:29 EST 2024

Total time taken to generate the page: 0.01043 seconds