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

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


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

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

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

This topic is 7994 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.