Jump to content

for (var i = 1;


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

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Screenshot.jpg

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

I guess is the one sec pause in between records, is to allowing for the script to finish coping all the fields.:laugh:

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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? :content:

Thanks in advance,

A

Link to comment
Share on other sites

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 by Guest
Link to comment
Share on other sites

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