Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

  • Newbies
Posted

Hi.

 

I have 12 fields with the names Phone1, Phone2, Phone3, ....  I have go through each and do some work on it.  Obviously, I don't want to recreate the same procedure 12 times.  I like to use the field by the count I'm on.

 

Here's the start of the code:

 

set variable [$PHCount; Value: 0 ]

Loop

set variable [$PHCount; Value: $PHCount + 1 ]

 

##### here I'd to set a variable to field Phone and whatever $PHCount is on

##### so if $PHcount is equal to 1 the variable is equal to Phone1

 

End Loop

 

TIA.

 

Boyd

Posted

The Phone fields should be separate records in a related table.  That table should contain the fields ID (auto entered serial number), MainID, and Phone.  It should be related to your main table by MainTable::<yourIDfield> = Phones::MainID. Your script would then be:

 

Freeze Window

Go to Related Records[show only related records; From table::Phones;Using layout:Phones]

Go to Record[first]

Loop

#perform your operation

Go to Record[next; Exit after last]

End Loop

  • Newbies
Posted

Doug:

 

Thanks for the tip.  Not exactly what I did, though.  I decided using a repetition field made a lot more sense.

 

Thanks.

 

Boyd

Posted

 I decided using a repetition field made a lot more sense.

 

 

You may change your mind if a) you ever have to create a report based on those phone numbers ("how many are in Area Code 212?") or b ) you have a record with a 13th phone number.

  • Newbies
Posted

Doug:

 

Deinitely.  But, this was a case of where I ws importing a flat file with multiple phone numbers.  In fact, it was a labeled phone numbers, but had phones and emails in it.  I just needed to massage the data and export it right out.

 

Thanks.

 

Boyd

Posted

And if they had been separate records then you would have just performed a simple find operation to separate the email records from the phone records. 

Posted

##### here I'd to set a variable to field Phone and whatever $PHCount is on

##### so if $PHcount is equal to 1 the variable is equal to Phone1

 

GetField ( "Phone" & $PHCount )

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