On 10/9/11 7:38 AM, Vineet Deodhar wrote: > Hi ! > I have a parent-child relationship between 2 tables. > Its simplified version is as under > ------------------------------------------------------------- > account-master table: contains financial account heads master > ac (acid, ac_code, ac_name, opening_bal, credit_limit, tax_num) > > employee master table: > emp (empid, acid, grade, birth_dt, join_dt, active, skill_lvl) > ------------------------------------------------------------- > 1st table is parent& the 2nd is its child. > > Values for all the required fields in "ac"& "emp" are available in my > web-form. > > When a new employee is added (i.e. in child table), firstly a new entry > should be added > in "ac" table. > Its auto-generated pkid (from DB) is to be taken to fill "acid" fk_constraint > in "emp" table. > Then the 2nd table "emp" is to be saved. > > I read the doctring for NewChildOnNew() (if at all, it is the intended method > for this kind of thing) > & tried to code accordingly. > >>> >> ac.addChild(emp) >>> >> emp.new() >>> >> emp.setFieldVal(...) >>> >> same for "ac" table > > But could not understand how proceed. > > Can someone please tell me what is the right way to do that.
Dabo does this for you, assuming you have the KeyField and FillLinkFromParent properties filled in correctly... Then you can get the pk of the Parent, if needed, by: print self.Parent.getPK() Paul _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/[email protected]
