Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Losing relationship with parent!!!

Featured Replies

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!

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

  • Author

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!

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.