Adding Grid as Detail to Form and Selecting by Field

I added a Grid (Order History) to my Orders Form and I want to make sure that only orders with that orderID are shown.
The Master Detail doesn’t allow me to select parameters for grids.

How do I select the order ID from the parent application so only results with the matching orderid are shown?
e.g. SELECT * from ordershistory WHERE historyorderid = orderid

Re: Adding Grid as Detail to Form and Selecting by Field

in the project, in the drop-down list on the left, there is 1 option ‘SQL’, you can set the WHERE clause and also the ORDER BY clause. You would probably need to pass the order id to the grid.

Re: Adding Grid as Detail to Form and Selecting by Field

Thanks for your reply. SQL statements are no problem. My question is HOW do i pass the order ID field to the grid?

How do i put the OrderID from the parent form into a variable?
What should the order ID variable look like?
can you show me a sample statement?
select * from orderhistory WHERE order id = orderid

I know you can use sessions but I am afraid of the session persistence when I leave the page.

Re: Adding Grid as Detail to Form and Selecting by Field

Alright you didn’t listen, when you open a project, there is a tree list view on the right that has the settings, fields, and a bunch of other stuff. If you click the SQL option, it opens a form on the right where all you need to do is put in the WHERE clause or the ORDERBY clause. You don’t need to write your own SQL statements. You might be able to set the orderID as a global,


$order_ID = {orderID};
sc_set_global([order_ID]);

I’m not 100% where to put that, obviously in one of the ‘events’. I don’t knowq exactly what you’re trying to do but maybe someone else will come on and figure it out. Or you could explain yourself some more. Just so you know, to refer to a field in a form, its { } around the field name, so {orderID}, k?

Re: Adding Grid as Detail to Form and Selecting by Field

I vivid. Thank you for your response.
I was afraid to set the orderid as global because I don’t want it to persist when I had another order open.

$order_ID = {orderID};

Can i do this without setting any global variables?

Re: Adding Grid as Detail to Form and Selecting by Field

thats not a global, the {} is to reference different fields. a global is []

Re: Adding Grid as Detail to Form and Selecting by Field

Got it. Thanks!

Re: Adding Grid as Detail to Form and Selecting by Field

I’ve tried the above… works fine only… I loose my edit button…

and that is what i want to do… in the master record show a grid with details and be able to edit the details using a (singel row) form…

hope you understand what i’m trying to do here…

tnx