Jump to content

Copy Record From Portal


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

Recommended Posts

  • Newbies

>In File A the user will enter a last name.

>The portal in file A will then list all addresses from File B where the last name matches.

>I want a button in each portal row...once clicked it will copy the 4 address fields from that portal row to fields defined in File A.

I am new to FM, but much exp in DB's & programming. I have the button in each portal row, but I can only get the script to copy all of the displayed portal records. I have not figured out how to specify individual fields in a single row. Any help here?

Link to comment
Share on other sites

quote:

Originally posted by menkes:

>In File A the user will enter a last name.

>The portal in file A will then list all addresses from File B where the last name matches.

>I want a button in each portal row...once clicked it will copy the 4 address fields from that portal row to fields defined in File A.

I am new to FM, but much exp in DB's & programming. I have the button in each portal row, but I can only get the script to copy all of the displayed portal records. I have not figured out how to specify individual fields in a single row. Any help here?

You don't even need to run an external script. Let's say that the relationship the Portal is based on is "FileB|LastName" and the addresses in each portal row are "Address1" thru "Address4" and that you have similarly named fields in your File A. Then the following script should do the job.

Set Field [ Address1, FileB|LastName::Address1 ]

Set Field [ Address2, FileB|LastName::Address2 ]

Set Field [ Address3, FileB|LastName::Address3 ]

Set Field [ Address4, FileB|LastName::Address4 ]

If this script is attached to a button in the portal, then the related record that the script will be working with will be the portal row the button was in.

Chuck

Link to comment
Share on other sites

How about a different way. Define a relationship to File B (call it "Select") where a field "Selected_File_B_Record" matches a field "Record#" in File B. The button on the portal row performs a SetField(Selected_File_B_Record, FileB::Record#)

Now you can do one of three things:

1) Display the relateded fields from the "Select" relationship from File B in File A.

2) Perform a lookup based upon the relationship into the four fields in File A.

3) Use four SetField steps in a script to copy the fields Select::Address1, Select::City, Select::State, and Select::Zip (I'm guessing at your desired fields) to the corresponding File A fields.

-bd

[This message has been edited by LiveOak (edited September 14, 2000).]

Link to comment
Share on other sites

  • 1 month later...
  • Newbies

I have a similar situation for a new order entry system I'm building. Because I have to have two different types of product ordering procedures which are mutually exclusive I created another file where the customer lookups are performed. Here's how I set it up.

The search file will only ever have one record. On that record is a field where the user enters the customer's last initial and first 5 digits of their zip code. I have a portal setup relating to the customer database by way of a calculation field that returns every customers last initial/5 digit zip code combination.

Back in the search file I also have a global field for the customer ID number that has a relationship to the customers file. I also have all the pertinent related fields from the customer database in the search file.

So here's what happens. The user enters the search criteria and the portal shows a list of matches. Clicking on a portal row copies that customer's ID to the global customer ID file. This then brings up just that customer's information in the search file and can be edited if need be.

Lastly, I have a button that runs a script to copy the customer ID from the global field, go to the appropriate order entry file and run a script there that creates a new record and pastes the customer ID into the customer ID field in that file to bring up the customer's info for that new order.

A little round about, I know, but it work remarkably well and is not as difficult to set up as you may think.

Link to comment
Share on other sites

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