Master Detail New Data entry forms

I am new to Scriptcase and have been working with Master-Detail applications. I am able to create applications that link and show the associated detail records from existing tables.

I now want to use Master Detail to insert new records in the Master table then add associated records into the detail application. I have created forms that connect and add records to both tables, but when I link the detail to the master, the master updates, but does not call the detail application to load the records into the detail table. I have the foreign key identified in the link, and the block for the detail form shows up on screen.

Is there an Ajax event needed to pass the key field to the detail form from the successful inswrted record in the master table? Any help or advice would be appreciated.

Show us how you made the link (printscreen of link and properties).

In linking again, I am getting a message regarding parameters definition, but when I try to click on the url for the explanation I get a #blocked page.

I have set up a Global variable on my Master, [OrderNo] and have set up the GET on the detail form to accept the varaible. In testing the detail form I was able to enter a value into the opening screen that s looking for the variable and the data was loaded correctly into the detail application.

Maybe your server blocks you from reading external pages ?
Here is the same page and the 2 links:

If you use the Master/Details feature, you only link to link the detail tothe master with the foreign key as you did. You don’t need to use a global variable.
I’m not sure if I have understood the main issue about your master and details …

Thanks jefch,
My main issue is that both Master and Detail open and connect separately, but when I link them through Master Detail link, the Master opens and updates the table, but the detail does not open.

So you link the detail to the master through the master/detail feature and when you open the master application you havde the detail in a block (set up as a tab or regular block)?

The block appears and my label is there, but when I insert the Master record, the detail table does not activate.

I am thinking I am trying something that is not supported. Basically, I want to add a new order record which has the customer information, the dates requested, and any notes about the order. Once this is entered, I want to use that OrderId (PK) to link to the Order Detail table which selects the items and quantities in a multiple-line form and calculates the total cost.

Individually these both work fine, but I cannot get the detail form to appear when the master record is inserted.

You insert a master record and save it. And now you shouls have the detail block showing up with the “Insert” button and the “No record” message.
And you don’t have it, right?
Make sure your detail does not use any global variable in its “where” clause because it may not be initialized correctly when you insert yout master. Try with the foreign key only first.
Then when it works you can play around with “onAfterInsert” event to reassign your global with your master id to check if it works.

Currently, I am using only the master-detail link to connect the applications linking on the foreign key (orderId). When the master updates, there is no change in the behavior of the detail, the block remains grey and unchanged with no messages. I am using a basic form for the master and a multiple-line form for the detail.

Ok. So my question is: when you update the master, what is supposed to change in the detail?
Usually the detail is loaded right after the master is loaded. IF you change the master then the detail is loaded accordingly.
But if you just do an update of the master, I don’t know why the detail should be reloaded !!! Maybe I have missed something :sleepy:

This is very helpful, I am trying to enter new data into the orders (master) table to create a new order record. I then would like to insert new records into the orderDetail table using the order table PK as my FK to the details.

I am thinking that since there are no matching detail records when I create the new master record, this is why the detail application does not open. I am wondering if I need to add code to the onValidation event to create the global variable for the record id and pass it to the detail application using a redirect?

I started again and decided to use a editable grid form. I am now able to get the detail to activate once the master record has been entered and saved. BUT now I am finding I can only add one record to the detail application… any thoughts on this?

I figured out that the new line requires the Checkmark to be clicked to add a new line. I thought I had this finally working, but once I figured out how to add a new line, the detail application stopped working. I am discovering there is an issue with the navigation buttons, but I think I now have it working.

Ok. I think now I’ve finally understood your issue. Sorry for taking taht long :slight_smile:
When you update your master, you are adding or updating records in the detail through SQL from the master and these detail modifications don’t appear. Makes sense.
Try in the master on the onValidateSuccess to “sc_redir” your master to itself. This will reload the master and the detail.
Hope this helps.

Thanks, that did help. I am now able to insert new Master and Detail records