December 16, 200322 yr 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!
December 16, 200322 yr 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.
December 16, 200322 yr 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.
December 16, 200322 yr 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.
December 18, 200322 yr 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