Jump to content
Sign in to follow this  
MrEase

Go To Related record of all Found set

Recommended Posts

MrEase

Hi there,

 

Going to related records of the record you're in is simple but if I have 5 found records and want to go to all the related fields of these 5 records...how do I go about. This without having to change data and do a search afterwards (would take too long).

 

As an example imagine I have an address book with companies and contacts. I make a search in companies and find 5 with each two contacts. How do i go to a Contacts presentation showing only the ten related contacts???

 

many thanks

 

Henk

Share this post


Link to post
Share on other sites
-Queue-

You need a relationship between a global text field and the related external key. Then you need to use either a loop with Set Field [gText; gText & recordID & ¶] for each found record or create a layout containing only the recordID, Copy All Records, go to a layout holding gText, and Paste into gText. Either way will result in a return-delimited list of the found recordIDs in gText. Using GTRR [show only; "relationship"] will then find all related records for each recordID in gText.

 

If you opt for the loop, be sure to nullify the global before starting the loop.

Share this post


Link to post
Share on other sites
MrEase

thanks -Queue-

I didn't even realize Copy all records script step existed!

Share this post


Link to post
Share on other sites
Kathy

Queue,

 

Can you explain that in a bit more detail? I think the script you describe is what I need too. I have related files: contacts and activities. I am looking at a found set of people in the activities file and want to have that group found in the contacts file so I can print letters. Can you help?

 

Thanks.

 

Kathy

Share this post


Link to post
Share on other sites
-Queue-

Sure thing. Create a global text field in your activities table and a relationship between this global and the serial (unique id) in contacts. Then create a script to

 

Freeze Window

Set Field [activities::globaltextfield; ""]

Go to Record/Request/Page [First]

Loop

Set Field [activities::globaltextfield; activities::globaltextfield & activities::contactserial & ¶]

Go to Record/Request/Page [Next; Exit after last]

End Loop

Go to Related Record [show only related; "globalToSerialRelationship"]

 

The found set in the resulting contacts layout should then consist of matching ones from activities.

Share this post


Link to post
Share on other sites
Kathy

Okay. I created a test db where it worked. In this test db my contact number was defined as text field that was a serial number.

 

However, in my working contact db my contact id is defined as a calculation that is text (first letter of first name and the last name). In my activity db the contact id is defined as text. This did not work. It only found that last record in my set.

 

Any ideas as to why? Can this work if my match field is a text calculation?

 

Thanks for the help.

 

Kathy

Share this post


Link to post
Share on other sites
Ender

Hmm, I don't know if this is the cause of your immediate problem, but having your ContactID build from user editable fields like names is bound to cause problems down the road. The IDs that you use as primary relational keys should be made from auto-entered serial numbers (or some other technique that guarantees uniqueness,) and should not be modifiable.

Share this post


Link to post
Share on other sites
-Queue-

Make sure the Set Field line contains activities::globaltextfield in the calculation. It sounds as if it only contains the activities::contactserial & ¶ portion.

 

Listen to Ender. His advice is sage.

Share this post


Link to post
Share on other sites
Kathy

I double checked and I do have my global text field in the script.

 

I did take your advice and converted my ID to auto enter serial numbers, but I still can't get the script to work. It will only find the last record of the found set in my activities file.

 

Any ideas?

 

Thanks in advance. Kathy

Share this post


Link to post
Share on other sites
-Queue-

Put the global field on a layout and click into it. Do you see more than one id listed?

Share this post


Link to post
Share on other sites
Kathy

Yes, they are all listed in my gloabal field.

 

Would it matter that I am using FM 5.5 instead of 7?

Share this post


Link to post
Share on other sites
-Queue-

It should work then. Can you attach the files?

Share this post


Link to post
Share on other sites
Kathy

You know it worked in test files I created, but no in my original files. I did find a way to re-write the script and now it works just fine. Go figure.

 

This is how I wrote the script.

 

First I created a layout with only the contact id in it. Then I made sure that their was a layout that had the global text field in it and wrote the script like this:

 

Go to layout (the one with the contact id only in it)

Copy all records

Go to layout (the one with the global text field in it)

Paste [select "global text"]

Go to related record [show, "global text field"]

 

And that works.

 

Now, at the risk of screwing things up, can I create a script from this that will do the following?

 

I have a script in my activities file that finds all the things/contacts that I have to do something about today. Some are phone calls, some are emails, some are mailings. So, after I have found the contacts for the day I want to only find the related records for the people that I have to mail something to. I have a field called activity type in which I put in "mailing", "phone", etc.

 

Is there a way to add to the current script to do this?

 

By the way, thanks for the help!!!!!!!!

 

Kathy

 

Thanks again for the help.

Share this post


Link to post
Share on other sites
-Queue-

That is the other common method. But both produce the same result, a return-delimited list of ids. So to the GTRR step should perform the same for both. Very odd.

 

Add 'mailing' to your find criteria in your script. So, your script will look something like

 

Allow User Abort [Off]

Set Error Capture [On]

Enter Find Mode [ ]

Set Field [datefield, Status(CurrentDate)]

Set Field [activitytype, "mailing"]

Perform Find [ ]

If [not Status(CurrentFoundCount)]

Show Message ["No mailings were found for today."]

End If

 

I think this is what you are asking. If I'm wrong, let me know.

Share this post


Link to post
Share on other sites
Kathy

Thank you!!!!!!!

 

This is a great forum.

 

Kathy

Share this post


Link to post
Share on other sites
This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use