Parent Child functionality

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Thomas
Posts: 1
Joined: Tue Oct 11, 2022 11:47 pm

Parent Child functionality

Post by Thomas »

My current understanding of AwareIM is ... limited, but growing.

If two Business Objects have a Parent/Child relationship where the child records must have a parent, does the process of importing child records automatically create the requisite parent record?

I've been out of the computer world for 16 years. My last serious development environment (1989-2006) was Magic. In magic terms, I'm looking for "link / write" functionality.

Also, this is my first entry in this forum. If there is a better place to ask questions such as this, please let me know.
BLOMASKY
Posts: 1470
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: Parent Child functionality

Post by BLOMASKY »

Welcome Tom.

How are you "Importing" the child records? The child record has 3 columns that indicate: 1) Who the Parent is. 2) What is the primary key (THE ID) of the parent, and optionally the (virtual) name of the field in the parent BO that is used to access the child records. Easiest if you create a parent and child in Aware, add a couple of records in both and look at the data in SQL so you will understand what is there.


Bruce
BobK
Posts: 544
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: Parent Child functionality

Post by BobK »

Thomas wrote: Wed Nov 02, 2022 6:11 pm Also, this is my first entry in this forum. If there is a better place to ask questions such as this, please let me know.
This is the place and welcome.

Thomas wrote: Wed Nov 02, 2022 6:11 pm ...does the process of importing child records automatically create the requisite parent record?
No.
I am not sure this will work but you might try adding a rule to the Child BO to create and Parent. The rule would look something like:
If Child IS NEW Then
CREATE Parent
INSERT Child IN Parent.ChildField

There is also an IMPORT RELATIONSHIPS action that you might want to investigate.
Bob
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Parent Child functionality

Post by PointsWell »

There is a CREATE IF NOT FOUND flag for the IMPORT action. If you create your import file to have a relationship to the parent then it will create that record

Code: Select all

Employee.obCompany.Name, Employee.StaffNo, Employee.Name
"Mega Corp", 12345, "Jones, Steve"
If Mega Corp doesn't exist and you use

Code: Select all

IMPORT Employee FROM 'c:/mydocuments/importfile.csv' CREATE IF NOT FOUND
It should create that record. You might get duplicates if there are 17 employees that work for Mega Corp as the commit won't happen until later, in which case IN BATCHES OF will help.
Post Reply