fireemt1 Posted June 14, 2003 Posted June 14, 2003 Newbie question. Ok, I got 2 relational db's. "Horse" & "Horse Tasks". Now, on one layout of "Horse" I want to type information into about 4 fields, and then when I click a button (more than likely to run a script) it will create a new record in the second db (Horse Tasks) and place that info into the appropriate fields. Ive tried everything that I can think of, which isnt much <lol>. Best I can do is make it produce the new record, but it stays blank and overwrites another record. Any help would be greatly appreciated.
Ugo DI LUCA Posted June 14, 2003 Posted June 14, 2003 Hi, You'd new a relationship from Horsetasks to Horses, a set of global fields in the Horse file, and a script in the HorseTasks : New Record Set Field (field 1, rela::global 1) Set Field (field 2, rela::global 2) Set Field (field 3, rela::global 3) Set Field (field 4, rela::global 4) Then call this script as an external script in the Horse file. Now, the easiest way would be to use a portal set to "allow creation of rerlated records". No scripts, your 4 fields in the portal. Hope this help
Fenton Posted June 14, 2003 Posted June 14, 2003 You say these 2 files are "relational." What is the relationship? That's the "key" (pun, lame). While I often use scripts for creating related records, perhaps we should start with the simplest mechanism first; which is FileMaker's ability to "allow creation of related records." It's a checkmark choice in the Relationship dialog. The relationship should be based on a unique field. A good idea is to create a serial ID field, auto-enter, start with 1, increment by one. It can be either text or number (at this point). These are choices when you create a field, in Options dialog, Auto-Enter, Serial number. This would be in Horses. Create a field in HorseTasks to match, say "HorseID." But don't make it auto-enter. Just a text or number (whichever the other was). The relationship is then Horses' SerialID to HorseTasks' HorseID, with "allow creation." If you want to create more than 1 task per horse (likely), do these steps. In Horses, create a Portal. That's the square tool with corners but gaps in the sides. It will ask for the relationship. Specify the above. Drag fields (field tool) into the Portal's 1st line. Define them according to the relationship (a little drop-down box above the fields in the little dialog window). After choosing the relationship you should see the fields from HorseTasks. In Browse mode you should now be able to type into any of your 4 fields, in the last, empty row of the portal. You can show the ID in the Portal, but don't allow typing into it. FileMaker knows what the key is and will fill it in for you.
Recommended Posts
This topic is 7890 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 accountSign in
Already have an account? Sign in here.
Sign In Now