Populating three data blocks with two 1:N relationships [message #361376] |
Wed, 26 November 2008 02:48  |
sindikalac
Messages: 52 Registered: November 2008 Location: Europe
|
Member |
|
|
Hi, here is the story.
I have three tables, table1, table2 and table3. Relationship between table1 and table2 = 1:n, also table1 and table3. The same thing is with data blocks, I based data blocks on the above tables, db1, db2 and db3.
I created one canvas and placed all tree data blocks on that canvas.
The problem is, I would like to populate all data blocks on the same canvas. I tried it with WHEN-NEW-FORM-INSTANCE on the form level, it didn't work. How can I populate this, because I have in db2 and db3 many records, and in db1 just one record connected to those records in db2 and db3.
|
|
|
|
Re: Populating three data blocks with two 1:N relationships [message #361531 is a reply to message #361443] |
Wed, 26 November 2008 15:59   |
sindikalac
Messages: 52 Registered: November 2008 Location: Europe
|
Member |
|
|
I have problem with this. I created as you said dblocks using wizard, and relationships were created.
In db1 there is ID, which is the same as ID in db2 and db3. Blocks are connected via ID.
Now, I have form1 and form2. I pass from form1 ID to form2 as parameter. Form2 is the form with those three data blocks. And I want to populate form2 when jumping from form1 to form2. I mean how to populate just those records related to specific ID, for example ID=2 (ID which I passed as a parameter value);
I tried it with WHEN-NEW-FORM-INSTANCE writing Execute_Query. Before that I assigned parameter value to ID. And just db1 and db2 were populated with records, db3 was not populated. Any suggestion how to do this?
|
|
|
|
Re: Populating three data blocks with two 1:N relationships [message #361589 is a reply to message #361566] |
Thu, 27 November 2008 01:58   |
sindikalac
Messages: 52 Registered: November 2008 Location: Europe
|
Member |
|
|
Unfortunately, I couldn't run the form, because I use Forms 6i, but thank you a lot, I used it to compare property palletes.
It seems all fine, I noticed when I changed order of data blocks in data blocks tree (Object navigator), for example, initial order is:
db1
db2
db3
and I switch db2 with db3:
db1
db3
db2
then just db1 and db3 populate, before the swith those were db1 and db2. I will continue to try...
|
|
|
|
Re: Populating three data blocks with two 1:N relationships [message #361819 is a reply to message #361734] |
Fri, 28 November 2008 03:00   |
sindikalac
Messages: 52 Registered: November 2008 Location: Europe
|
Member |
|
|
djmartin wrote on Thu, 27 November 2008 18:31 | Do you have two 'relations' defined?
David
|
Yes sir I have: db1_db2 and db1_db3. One more interesting situation: When I base data relate db2 and db3 to separate canvases, it works. When I put all three tables (data blocks) on one canvas it won't work.
|
|
|
|
|
Re: Populating three data blocks with two 1:N relationships [message #379097 is a reply to message #362358] |
Sun, 04 January 2009 17:02   |
sindikalac
Messages: 52 Registered: November 2008 Location: Europe
|
Member |
|
|
djmartin wrote on Tue, 02 December 2008 00:49 | You DO have the blocks defined in the order db1, db2, and db3 don't you? Have you modified the generated code at all? If yes, I suggest starting again with a new form. Create the blocks, db1, db2, db3. Then create the 'relations' db1_db2, db1_db3.
David
|
Your suggestion helped me to solve the problem, I created the form again from the beginning and it works. But here is another problem. I have to use this form, in the way that I open it from another form, and pass a parameter to it.
When I pass a parameter (which is ID number of db1 and also db2 and db3) from form A to form B (that's my form I created again), and when I assign parameter value to ID of db1 in WHEN-NEW-FORM-INSTANCE, and execute query, I don't get all data in the form, just partial ones. When I enter query without passing parameter, I do get all data.
My problem is how to pass that parameter in which I put the ID number of record I want to see in my form.
|
|
|
|
Re: Populating three data blocks with two 1:N relationships [message #379275 is a reply to message #379152] |
Mon, 05 January 2009 16:14  |
sindikalac
Messages: 52 Registered: November 2008 Location: Europe
|
Member |
|
|
Littlefoot wrote on Mon, 05 January 2009 03:03 | Quote: | when I assign parameter value to ID of db1 in WHEN-NEW-FORM-INSTANCE, and execute query ...
|
Try not to do that in the WHEN-NEW-FORM-INSTANCE trigger, but in the PRE-QUERY trigger.
|
Thank you man! God bless you! This worked fine. I assigned a value in PRE-QUERY and put execute_query in WHEN-NEW-FORM-INSTANCE trigger.
|
|
|