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

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

Recommended Posts

Posted

I have a portal that contains 3 fields. two standard text fields and one field that is a check box for "yes/no". This too is a text field, it's just based on a value list [Yes:No]. The portal itself is based on a self join relationship of a calculated field. No biggie all is displayed well.

The goal is to be able to loop through the portal and find the first record with the radio button checked Yes, then grab the text from one of the above mentioned text boxes of the same record and copy it onto the current or master record (the one containing the portal).

I'm not sure how to do this, although my gut feeling is that I will need to do some sort of loop on the related records and not really use the "go to portal row" script step. What I'm having trouble with is, looping through all the related records find the the first "yes" one and then copy the data back to the original record text field. I hope this isn't too confusing, I think it's probably not too hard, I just get confused on the navigation.

Posted

The information doesn't exist in the portal, it exist in the child file. You will to do your search in that file.

Posted

By child file I guess you mean, the referred to record? That is, the record from which the portal data comes from. Not sure of the correct terminolgy, but I think I know what you are saying. I think having the existance of the "go to portal row" got me thinking there may be an easier way, as I am having difficulties organizing the script.

Posted

Hi Paul,

Sorry, I usually only use FileMakers terms for relationships, but didn't in this case. You are correct. The related record is the same as Child.

In any event, the portal is only a way to see this information in the related file, but it really only exists in the related file,

HTH

Lee

Posted

Hi Paul

If you only need the first result in your portal with a "yes" result then the simple solution would be as follows:

Create another relationship exactly the same as the one used for your portal - but sort it by the yesno field (descending). Well call this relationship R2

Now, lets call your existing text fields as text1 and text2 and the fields you want to copy to on the layout with the portal we will call master1 and master2.

Now your script must: SetField [master1,R2::text1] and SetField [master2,R2::text2]

That is all you need to do, because of your sort order in the relationship the record with the first yes will be referred to.

Pete

Posted

Hi Pete,

I finally see some good stars here under your name grin.gif

Yes, this is actually a good one.

In addition to what Pete just said, using the sorted relationship, you may have 2 other options.

1.lookup fields from the related file

2. simple related fields

Now if one day you want a list of all first records being tag with a Yes in the related file, use this method.

In the related file, create :

1. a global field g_yes (obviously text with "yes")

2. a concanateglobal = g_yes & " " & Foreign Key

3. a concanateindex = yes/no & " " & Foreign Key

4. A selfjoin concanateglobal::concanateindex

5. a calculation = Case(Record_ID = Selfjoin::Record_ID,1,0)

This will tag any first yes record related to the Main file (using the Foreign Id).

As this is an unsorted calculation, you cannot use it directly with a Go To Related Record, but you can make a find on it or again sort your relationship based on this calculation.

Posted

Wow, that worked like a charm, thanks a bunch Peter. I didn't even know about the sorting option for relationships. Ugo, I deffinetly forsee an upgrade like you have mentioned. This Forum rocks!

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