Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

Losing relationship with parent!!!


This topic is 6782 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi all.

The setup: Access a customer record on a layout that is set to display records from the Customers table.

Decide to create an order: go to another layout, set to display records from Orders. (Orders is related to Customers through the pk_Cust_ID).

The instant I do this, the Customers::pk_Cust_ID field goes BLANK!!! (I'm tracking that field in Data Viewer).

So of course, the order gets created, pointing to a blank, non-existing, customer!!!

How come I'm not having access to the customer record, just by switching layouts???

[up to last night, I was using my own logic (storing field info into global variables, then using those to populate the fields of new order records, in order to have good control over the process); then, last night I disabled my logic and set the fields (in Orders) to auto-enter (Customers::pk_Cust_ID for fk_Cust_ID, order date, order status, etc.).

I'm sure the problem is not with that, because all the fields do auto-enter correctly. It's just that the bloody Customers::pk_Cust_ID is BLANK!!!]

Yet, when I navigate manually between layouts, the field Customers::pk_Cust_ID keeps the same value! As I would normally expect it to do!

Any idea of what I have done wrong???

Thanks!

Posted

3 "Legal" methods exists!

1) Grap the ID of the current cutomer record via a button, or a recursive script as a script paramter - here the recursive approach:

If [ IsEmpty ( Get ( ScriptParameter ) ) ] 

     Perform Script [ “Make Order”; Parameter: customers::CustomerID ] 

Else 

     Go to Layout [ “orders” (orders) ] 

     New Record/Request 

     Set Field [ orders::CustomerID; Get ( ScriptParameter ) ] 

End If 




Due to the ability to look backward thru the relation, will the script have two functions depending on which of the layouts it's executed 1) From the customers layout will it make a new order to that customer. 2) From the Orders will it dupe the present order ...but not the stuff in the portal if such exists in the order.



2) Write the ID to a $variable, rush to the order layout create a record and unload the $variable



3) Use that an order probably have more fields that the record ID and the foreign keyfield ...so make the relation allow creation of related records:




If [ Get ( LayoutNumber ) = 1 ] 

    Set Field [ orders::OrderDetail; Random ] 

    Go to Related Record [ From table: “orders”; Using layout: “orders” (orders) ] 

    Set Field [ orders::OrderDetail; Case ( 0;0 ) ] 

    Commit Records/Requests 

End If 

--sd

Posted

Hi, Søren. Thanks for the response.

Yeah. I went back to using method No. 2 which is what I was doing before. That works fine.

Nevertheless, I'm puzzled...

Thanks!

This topic is 6782 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.