aria Posted June 15, 2008 Posted June 15, 2008 Hi all, I have the following code in javascripts: Can someone help to convert it into FMPRO 9 script? Or is this possible in FMPro 9? for (var i = 1; i <= controller.getMaxRecordIndex(); i++) { controller.setSelectedIndex(i); if ( i==1 ) {globals.Num1 = subj_num; } else if (i==2) { globals.Num2 = subj_num; } else if (i==3) { globals.Num3 = subj_num; } else if (i==4) { globals.Num4 = subj_num; } else if (i==5) { globals.Num5 = subj_num; } else if (i==6) { globals.Num6 = subj_num; } Thanks in advance, A
pmconaway Posted June 16, 2008 Posted June 16, 2008 I would think this would be possible in FMP script. But I'm not sure what you are trying to do. It looks like your setting six global values based on the value of i. I description of what your trying to accomplish would be a great help. You can definitely loop through records in FMP script and set global values based on what is in the current record. In FMP 9 you can also set variables either locally (to the script) or globally.
aria Posted June 16, 2008 Author Posted June 16, 2008 Hi, Here is what Iâm trying to do: 1. Search for a record 2. Assuming there was one or more than one record was fund. 3. View each record one after another every one second, and copy each record fields one after another in to the global fields that has been already created. Letâs say there were 4 records was found, we want to view all the six records on the form at the same time such as following presenting them as horizontal rows: ID_First_name: Jim :) Alex :: Mary :: Michelle: Subj_num :: 1 :: 2 :: 3 :: 4 :: State :: CA :: NY :: TX :: OH I have the following script to loop through the found records: Loop Pause/Resume Script[Duration (seconds):1] Go to Record[Next; Exit after Last] End Loop Iâm attaching .jpg file that is the screenshot of a form that is doing the same think that Iâm trying to do in FM Pro. This screen shot is not from FMPRO Thanks in advance, A
aria Posted June 19, 2008 Author Posted June 19, 2008 (edited) I got it working. Attached is the screenshot of script: Thanks to all the help. A Edited June 19, 2008 by Guest
mr_vodka Posted June 19, 2008 Posted June 19, 2008 Glad that you got it working but I have no idea what you were trying to achieve. What is with the 1 sec pause in between records? I thought you wanted the layout to look like your attachment. :idunno:
aria Posted June 21, 2008 Author Posted June 21, 2008 I guess is the one sec pause in between records, is to allowing for the script to finish coping all the fields. There will be so many of fields that need to be copied. Please don't forget that I I’m a beginner and just start testing FileMaker Pro 9 on almost a week ago. Regards, A
mr_vodka Posted June 21, 2008 Posted June 21, 2008 Dont use copy and paste. It takes up your clipboard for no reason. Instead use variables to store the info. Also there is no use of using a loop if you have your script like that. In addition, anytime that you have field1, field2, field3, etc it usually means that your structure is off. There should be multiple records with one field. Loop Set Variable [ $subjectnum; DEM_REC_CHECKK_LIST::subj_num ] Set Field [ YourField; $subjectname ] Go to Record[Next; Exit after Last] End Loop
aria Posted June 21, 2008 Author Posted June 21, 2008 I’m little confuse about you script. Loop Set Variable [ $subjectnum; DEM_REC_CHECKK_LIST::subj _num ] Set Field [ YourField; $subjectname ] Go to Record[Next; Exit after Last] End Loop So, if I have source and targeted fields copy and paste as: For the first record we have: Source record copy from: Subj_num, ID_Date, Id_FirstName The targeted field paste to: Subj_num2 , ID_date2, Id_FirstName2 Then next record copy from: Subj_num , ID_Date, Id_FirstName The targeted field paste to: Subj_num3 , ID_date3, Id_FirstName3 And keep going until there is no more record left. So hwo do we use you script? Thanks in advance, A
mr_vodka Posted June 21, 2008 Posted June 21, 2008 (edited) In addition, anytime that you have field1, field2, field3, etc it usually means that your structure is off. There should be multiple records with one field. You are missing this. See here on normalizing data. http://en.wikipedia.org/wiki/First_normal_form Edited June 21, 2008 by Guest
Recommended Posts
This topic is 5997 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