gephry Posted February 7, 2007 Posted February 7, 2007 Designed a database for 8.5, now I find out it's going to be used in 8. I have a calculation field that determines an overall status of these related records by using List() function (depressingly native to only 8.5). Any ideas how to revamp this field definition? Field Definition: Let( [ $BinStatusList = List( OrBin_OrderNumber::Status_Bin ) ]; Case( IsEmpty( $BinStatusList ) or PatternCount( $BinStatusList; "Needs Duplication" ) = PatternCount( $BinStatusList; "¶" ) + 1; .........blablablablabla....restofcasefunction.......... ) ) There's not a way to have a Get( RelatedRecordCount ) or something, is there? With that I suppose I could make a custom function with a self-calling Get( PortalRowNumber ) if I knew how many portal rows there were..... Then again, I love to complicate things. Gotta be a simpler way.
Genx Posted February 7, 2007 Posted February 7, 2007 (edited) If you happen to have fm advanced lying around... ListFieldContents( Field ; RelatedCountField ; result ; n ) Let( [ n = n + 1 ; numRecords = Count(RelatedCountField) ; result= If( n > 1 ; result & ¶ ) & GetNthRecord( Field ; n ) ]; Case( n >= numRecords ; result ; ListFieldContents( Field ; RelatedCountField ; result ; n )) ) Usage: List( YourRelatedField ; YourRelatedPK ; "" ; "" ) Returns: My Name Is Earl And Isn't Really Alex Next Record Is Empty But The CF Doesn't Care Cause It's Counting A primary Key. Edited March 12, 2007 by Guest Changed "my" to "your"
mr_vodka Posted February 7, 2007 Posted February 7, 2007 These examples by John Mark Osborne should help you. Comparison of different approaches to the List function Portal Info in a list
gephry Posted February 7, 2007 Author Posted February 7, 2007 mr_vodka --- the "Portal Info in a List" downloaded an empty folder. but the other link you posted worked fine. that Comparison is a great example, thanks! Genx --- I do happen to have a Developer copy sitting around so I ended up using ListFieldContents() function. thanks! that was a good quick fix.
gephry Posted February 7, 2007 Author Posted February 7, 2007 Hm, weird. I've tried it on my G4 and on my Intel and I'm still just getting an empty folder. Odd...
mr_vodka Posted February 7, 2007 Posted February 7, 2007 (edited) Is there is setting that you have to change on your mac to display files with no application associated with them? You probably dont have FM6 and the files are .fp5 files. Once located, you can just convert them to .fp7 by dragging and dropping into the FM8. Edited February 9, 2007 by Guest TYPO
gephry Posted February 9, 2007 Author Posted February 9, 2007 Nope. Macs show all files regardless of whether you have an application associated with them. (I do have FM6 by the way.) I ended up going to their website and navigating to see if I could find it. A couple other .zips did the same thing.... I've tried a few browsers, too; no avail. I'll try on another computer in my office tomorrow. Dunno!
Newbies Dave Martin Posted February 17, 2007 Newbies Posted February 17, 2007 I'm guessing that ListFieldContents is an FMP 8.5 Advanced function, because it doesn't exist in FMP 8.0 Advanced. Or am I missing something here?
Genx Posted March 12, 2007 Posted March 12, 2007 Hi Dave, your missing something Its a custom function, i.e. one you create yourself using the advanced version of FM. Go to File > Define > Custom Functions. Create a New Function Call the function:ListFieldContents Add these 4 as the variables: ( Field ; RelatedCountField ; result ; n ) This is the main portion: Let( [ n = n + 1 ; numRecords = Count(RelatedCountField) ; result= If( n > 1 ; result & ¶ ) & GetNthRecord( Field ; n ) ]; Case( n >= numRecords ; result ; ListFieldContents( Field ; RelatedCountField ; result ; n )) )
Genx Posted March 12, 2007 Posted March 12, 2007 Just to clarify, it doesn't have to be a primary key (your related table might not have one) it just has to be a field in your related table that is never empty... primary keys just always exhibit that characterstic
Recommended Posts
This topic is 6527 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 accountSign in
Already have an account? Sign in here.
Sign In Now