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.

Assigning records in seperate file

Featured Replies

I am trying to assign records in a seperate database with data from records in the first. The problem is that the script is only assigning the first record over and over again.

How I have things set up is the first database (Statement Entry) is the data entry part where questions are assigned on one layout then the question text is automatically inserted into a seperate layout (magic!) where the responses to the questions are entered for each respondent. I have things set up so the records are one to each respondent. Each question has 3 factor fields where the user assigns a broad definition(s) to what the respondent said.

The second database (Factor Assignment)is where I'm trying to take the Name, Factor Name and Statement Text and assign each set to individual records.

The script is a loop from the first database (Statement Entry) starting at the first record and looping until the last record. The loop calls a script in the second database (Factor Assignment) that assigns the Factors, Statement Text and Name to new records. Then the second database calls a clean up script that loops through the records and deletes any records that don't have a factor name. (Some statements only have one or two factors.)

It works perfectly except for the fact that it will only copy the data from the very first record. I've steped through the script and the loop is working (moving to the next record and staying there until told to move again) but FMP still takes the data from the first record.

I've tried omitting the record after assigning it but FMP still assigns the first record.

I've tried assigning the fields in database 2 (Factor Assignment) from the first database (Statements Entry) but it doesn't assign the data and I end up with blank records.

I'm willing to overhaul my script but I can't think of anyother way to do the assignment besides assigning every statement to a generic global in the first database and then assigning the global in the second. The only problem is that is a huge amount of scripting to add on top of the monster I already have in the second database.

Help!

It's a bit hard to troubleshoot since I can't see your script. Were you careful to make sure your Go To Record/Request [first] is outside (before) your loop? If it's inside the loop, you'll never get past the first record.

  • Author

Yes, the loop is pretty much as follows:

Goto Record (First)

Loop

Perform Subscript(External Script:Factor Assignment.fp5)

Goto Record (next, exit after last)

End Loop

Goto Layout (View Factors)

Like I said, I've stepped through the script to make sure it was going to the next record. (I set messages to pop up when the new record step is called and looked at the current record. It is stepping through the records.)

I'm wondering more if there is a default where FMP will take the first record only.

OK. How is the information being transferred? Via a relationship?

I agree with John: the problem is probably with the external script.

Sabrina said:

I'm wondering more if there is a default where FMP will take the first record only.

There is, in fact. If you're not in a portal, by default FileMaker can only see the 1st record in a related file.

Don't perform ANY scripts in the second database. None.

Set up a global in the first database, gSelectedFactorID. Relate it to the record ID field in the other database (Factors?). Set the relationship to allow creation of related records. Now in your script:

go to record, first

Loop

set gSelectedFactorID, textToNum("")

set field [FactorsByGlobal::FirstName,FirstName]

#this creates the related record

set field [FactorsByGlobal::WhatEver,OtherField]

#etc

go to record next, exit after last

end loop

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.