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

Create new record without a portal


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

Recommended Posts

  • Newbies
Posted

To give some background on myself, I am completely new to Filemaker. I have some experience with design in Access. I have no idea how to create scripts and I'm hoping I won't need one, but I'll try if necessary.

I have a very simple database with only 2 tables: Organizations and Documents. An organization can have a large number of documents. The documents have a lot of attributes (about 15), while the organizations have very few attributes.

I would like to be able to go into the organizations file and view the related documents in a portal (which I was able to do successfully), but I would also like to be able to add new documents. Ideally, I would like to add a button from the organizations record that would open a new record for documents in another window and have the new record already reflect the corresponding organization. I feel that there are just too many document attributes to efficiently use a portal for adding new document records.

Thanks in advance for any input, advice, suggestions!

Posted

but I would also like to be able to add new documents.

You realize, of course, that you can create related documents records within the documents portal simply by adding data on a new blank line in the portal? In the relationship graph you need to have selected "allow creation of records in this table via this relationship".

Its easy enough to make a script which does the same and is activated by a button on the organization layout. See the attached example.

test.fp7.zip

  • Newbies
Posted

I've been trying to work this out today, but I think that I'm still not "getting" something. Here is the script that I have so far:

Go to field [Organizations::Organizations]

New window [...]

Go to Layout ["WebCaptures" (WebCaptures)]

New Record/Request

Set Field [WebCaptures::Organizations]

I think that I must be missing something with the set field command. The new window opens fine and gives me a new record, but the name of the organization does not transfer over from the Organization record that holds the button.

Posted

I think that I must be missing something with the set field command. The new window opens fine and gives me a new record, but the name of the organization does not transfer over from the Organization record that holds the button.

That's correct. The command 'Set Field [WebCaptures::Organizations]' specifies the field to set but does not specify any value. In my original tip I suggested using the 'Set Variable' script step as a temporary storage place for the name of the organization. However, I notice that you're listed as a FMP v7 user which, I believe, does not offer the 'Set Variable' script step. There are several alternatives, however.

1. One option is to use store the Organization name as a script parameter. You do this in layout by selecting 'Format button' for the button that you use to run the script. Under 'Specify...Optional Script Parameter...Edit...' Specify the Organizations field. Then under ScriptMaker edit the Set Field step to include the following calculated result: Get(ScriptParameter).

2. A second option is to create a global text field that does not show up on any layout but is used in the script to store the organization name (in a Set Field step). This is then used in the second SetField step to set the organization name for your new record. This approach clutters up your database with ad hoc global fields whose purpose can be hard to keep track of. The advantage is that multiple global fields can be created if you need to specify multiple parameters.

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