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.

Adding data in line-db on ly on specified lay-out

Featured Replies

Hi,

When I create a new record in a line-item from the main db it will create a record (using a script) but it will not enter data from the masterfile. It does work when I go to another lay-out in the line-db where all the fieds are shown.

I realize that i can only paste fields when they are in the layout (I do use setField alot though), but is there a way to work around this? Those line-db's should not be visible and when they are (by user action) I don't want to show the lay-out with all the fields. I tried to hide the lay-out from the menu so users cannot access it but then my script doesnt work :

TIA

JP

Your post does not indicate if your script is using the copy/paste step or the set field to create the data in the new record. Set field should work. If not, post more detail on your relational and script structure- you probably want to establish an all to all relationship and set the unique key field data into a global in the master file first to set the key field in the LineDB, and then use the one to one key::key to set the rest of the data.

-Raz

Raz is right. Setfield will work in any layout. Are you really sure these fields are the same in both layout ?

Hi Balooka smile.gif

Well, I guess my question is why you are using a script to create a new LineItem record? If your relationship is set (in Main) to "Allow creation of related records," a new LineItem will always be created (without script) whenever you add data to a LineItem (non-key) field!

If you simply insert data in a LineItem non-key field, either by entering data from a layout in Main or by using SetField on a LineItem non-key field, your LineItem record will be created if no related LineItem record exists. The reason (after you use a script to create a new LineItem key), that you can't add data to another LineItem field is 'probably' because FM hasn't recognized that the new LineItem record was created and thus doesn't recognize the relationship you are trying to SET the next field on. You would need to perform some other action to exit your LineItem key field), or go to another layout, etc. (which will exit your key field in LineItem) before FM recognizes the new LineItem record.

So, just let the creation of a new LineItem record be handled through your relationship (allow created) by using your script to set *any other* LineItem field using Set Field (LineItem::any non-key field). Your LineItem fields don't have to be on any layout in Main.

If you set it up this way, it should work fine!

LaRetta

  • Author

thank you all

I did have one copy/paste in my lineitems and I've reset them to globals with setfields - works fine now smile.gif)

Well, I guess my question is why you are using a script to create a new LineItem record?

Hi LaRetta,

This is simply a way of having more control over the creation of related records.

I am in the process of chaning my invoicing system to this method so that a script will be forced to run after each addition of a product. I will use this to adjust inventory, update the serial numbers tables (hardware serial numbers of items sold, not FileMaker), check for possible errors, and even put messages/advertising on the customer screen (for POS), or send data to a "Pole Display".

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.