Skip 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.

Trigger in table view & create related

Featured Replies

Hi!  I need assistance with a v11 file (attached).

 

Structure:  I have a table called Cables,  These cables have two ends ( EndPoints) which each have different information and must be summarised separately so they are related records - two related records for a cable.  

 

Process:  User will add Cables in table view (it must be table view) then type into yellow field to create one EndPoint record then type into orange to create the other EndPoint.   The User will perform heavy data-manipulation on this table.  User can change values in the orange field but they cannot add a new record through OppositeEnds relationship because it uses <> which I do not wish to adjust in any way.

 

However, table view will not fire a button in a row so I planned to use script trigger so we can enter the field (blue), establish a separate relationship, create the OppositeEnd then place the cursor into the orange field.  The idea is for the User to be unaware and it appear they are just typing their new record into the field like with the yellow EndPoint.

 

Example:  Attached file shows on form but there is another layout which is table view (it would not have the portal which is there only for viewing and testing).  Table view layout is where the functionality needs to work.

 

I decided that one script could do it all.  Create the new Opposite record, assist validation of max two records which will be enforced via Privileges, and place User into the orange field.  It works but it feels rough and I am hoping other ideas abound from my FM family to make it elegant because the question is ... where do I put the blue field?

 

I could make that blue field transparent but still, we cannot overlay fields in table view!!  The orange field can't be a button nor can its field be enterable if there is no related record so maybe make the blue field look like an ADD button?  Since it won't hold data - it'll just be used to kick off the trigger anyway.

 

How might others handle creating two related records via trigger in table view?

TableEntry.fp7.zip

  • Author

Well now the script doesn't work in table view but does in form view.  It doesn't enter the Else If[] in table view.  Well now ... it is inconsistent ... sometimes it will stop at the End If [] if no OppositeEnd and sometimes not.  I also realise that deletion of a record will need to take place on Form view.

Edited by LaRetta

Why not into the menus and run a script on New Record to create the related records in addition to the parent?

  • Author

Good morning, David!  Thank you for responding!  :smile:

 

I understand what you are saying - after all, it will only be two records.  But there are not always two records created, sometimes none.  And I do not want to create a connector end if not configured because it would count as a connector even if not used.  These EndPoints will have popups attached for selection of ConnectorTypes so it won't be an issue of mis-typing in the field ... it will have a correct value and create a record or it won't create the *EndPoint record at all.

 

I have worked very little with table view, considering it too dangerous.  However, this file will be used fairly open (separate from main file) and they will be adding fields, moving columns, sorting/searching and pretty-much treating it as an Excel spreadsheet.  I realise also that they can create empty Cable records by accident when in table view but I can't tightly control and protect while same time turning them loose on the farm.

 

Hey, if I were on the other side of this project, I would be highly discouraging table view usage, LOL, but they use table view a lot and won't settle for less on this one.  If I don't give them one, they will make it themselves and that would be worse because the perspective to related - if they just place fields from EndPoints or OppositeEnds, will produce incorrect results (if OppositeEnds isn't sorted) so I need to fulfill their request.

 

* one issue is if they change their minds after clicking the blue button is deleting the empty record so I still have more work to do on it anyway.

Why are you using the Opposite End TO? Why not just have two TOs, one for each end, each directly related to Cables? You probably need to add a constant the the relationship to clarify if it's the 1st or 2nd entry. Or add fk fields to Cables.

  • Author

There are structural reasons it is this way,   Someone MUCH greater than myself made that decision; it simply needs to be this way for this project.  :-)

  • Author

Hey David, I wanted to get back to you and thank you for the ideas.  We couldn't change that relationship because of other reasons so we added two key fields in Cables to use for creating the two child records, just as you had suggested.

 

Why not just have two TOs, one for each end, each directly related to Cables? You probably need to add a constant the the relationship to clarify if it's the 1st or 2nd entry. Or add fk fields to Cables.

 

  I appreciate your help on it.  :-)

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.