Jump to content

selcet portalrows


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

Recommended Posts

I have two files, Adresses and Projects. I need to be able to search on surnames so I made a relation between the two files. Because ther are more people with the same surname I made a portal to show all the matches. I attached a button to each portalrow so I'd be able to select the right match an copy it to the desired fields. I scripted the button as follows:

Copy [select,"surname::companyname"]

Paste[select,"companyname"]

Goto field

Copy [select,"surname::firstname"]

Paste[select,:firstname"]

Goto field

etc, 'till I have the whole adress.

But no matter what row I click on, I only get the first match (which would make sense without the script

Link to comment
Share on other sites

quote:

Originally posted by Yeti:

I have two files, Adresses and Projects. I need to be able to search on surnames so I made a relation between the two files. Because ther are more people with the same surname I made a portal to show all the matches. I attached a button to each portalrow so I'd be able to select the right match an copy it to the desired fields. I scripted the button as follows:

Copy [select,"surname::companyname"]

Paste[select,"companyname"]

Goto field

Copy [select,"surname::firstname"]

Paste[select,:firstname"]

Goto field

etc, 'till I have the whole adress.

But no matter what row I click on, I only get the first match (which would make sense without the script
Link to comment
Share on other sites

I think your problem is the "Goto Field" script steps. This script step with no parameters jumps you out of the portal row you are in and leaves no portal row or field selected. FileMaker has no idea where you are pointing and what to copy! This step serves no purpose.

For that matter, why use copy and paste? It is easier to use:

Set Field(company name, "surname::company name"

Set Field(firstname, "surname::firstname"

etc.

Clicking a button in the portal will select the correct row and run the script. -bd

Link to comment
Share on other sites

  • Newbies

Thank's for your reply, Capt. Kurt! I had no idea that my plan is so complicated. Let me try and answer your questions:

You asked: which file am I working from.

I have two files, Adresses and Projects. I'm working in the Projects-file and I need to get the adress-info from the Adress-file.

You've asked: what portal am I looking at.

A difficult one. I'm enclined to say a normal portal, but that's probably not what your asking. Th fields I specified in my portal are: companyname, firstname, surname,adress, postalcode (zipcode??), city/town. I attached a rollbar.Please specify is this is not what you need to know.

You asked: what is the relationship defined as.

It is a standard relation between Projects and Adresses. Projects surname::surname Adresses. So the relationship is defined on surnames. I KNOW this is not wise, cause surnames are NEVER unique, but I can't work with ID-numbers, because we don't know these numbers from approx. 1000 records in Adresses.We DO surnames so this is what I based the search/relationship on.

You asked: what exactly am I tryimg to accomplish.

It seems quite simple to me. I have a surname (contacts we work with), I need to get the adress, telephonenumber etc. from this specific contact. This is all listed in the Adress-file, I "only" need to get this info into the Projects-file.So that's why I made a relation based on the surname of this contact.

You asked: which version am I working with.

Filemaker Pro 5.0. It just the four of us working with it at our office, so no special features.

I hope this clearifies my question and I hope it enables you to coem up with an answer. One way or another. Let me just say that I'm grateful for all the thinking and time you put into this (not just for this question, but for all. It sometimes seems it's taken for granted that there's a place to get an answer on the weirdest questions, or just plain simple once, but I think it's GREAT!!!)

------------------

yeti

Link to comment
Share on other sites

Thanks for your reply, LiveOak!

I made the script and tried the script/button too, but it only still works for the first portal row (which makes sense, 'cause fm allways selcts the first match).

What do I need to do to make the selection work for the other rows too (I made six, so not too miss any matches). Has it to do with the fact that I copied the first button to the other five rows??

------------------

Yeti

Link to comment
Share on other sites

Although I can manage quite a few things with fm, scripting is still not really one of them.

Could you clearify your answer, Dan? I know what you're trying to say, but how would it look (in a script), could you help me with the different steps?

Hope I'm not being a nuisance.....:-(

------------------

Yeti

Link to comment
Share on other sites

Solution:

1. Make a unique number field (serialized) in the surname base. Call it AdrID.

2. Make a Global number field in your Projects base. (gChosen no.)

3. Make a script that take the value of AdrID and put it into gChosen no. [set Field(gChosen no., "surname::AdrID)]

4. Make a new relationship (surname_chosen) from Projects to Surname based on the gChosen no to AdrID.

5. When clicking your portal row button - run this script.

You can then (in the same script) transfer your address values through the new relationship, which is one to one.

[set Field(company name, surname_chosen::firstname) etc]

Link to comment
Share on other sites

If you are trying to set information from a portal row into the current record, all you have to do is...

Set Field(company name, "surname::company name")

That WILL do it. If you are still getting ONLY the first row, you need to examine your relationships. Make SURE that the relationship for the portal AND the relationship for the field you are copying ARE the same (remember to use the SET function). I can assure you they are not. That is your problem. Careful examination of these relationships and field selection will reveal your bug.

I have seen this problem several times before and I am certain this is your problem...

Fishma

Link to comment
Share on other sites

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