ori_wel Posted October 13, 2005 Posted October 13, 2005 I have a list of records in a "child" database, for which some data is repeated. Think a list of students where each student may have multiple records, one for each of her classes. I need a field which says basically "which portal row the record would appear on in the 'parent' record." If David has seven classes, I want his first record to say 1; the second, 2; etc. I don't want a summary field. GetSummary() is not of much use in my opinion. Is there a way to hard code this field? I have seen others do cool things with GetNthRecord, and I have adapted it to my own use (i.e. replacing GetValueListItems). I feel the answer is close. I would value and appreciate and feedback you could offer. DSW
Sanjai Posted October 13, 2005 Posted October 13, 2005 Hi, Sorry but can you explain using another example to what exactly you are looking for.
Fenton Posted October 13, 2005 Posted October 13, 2005 (edited) Take a look at the following Custom Function: PositionValue ( text; searchValue; start; occurrence ) At: http://www.briandunning.com/filemaker-custom-functions/list.php If you already know how to use GetNthRecord to get the list, just pass it to this CF. [Yikes, Brian's list is temporarily down. Here's the text of the CF, which I've saved: PositionValue ( text; searchValue; start; occurrence ) Geoff Wells, DataIsland Software LLC http://onestopfilemaker.com Same as the Position function but for Values Sample Input: PositionValue ( MyList; "Seven"; 1; 1 ) MyList contains One hundred Two hundred Thirty Four thousand Five hundred Six hundred Seven Eighty eight Sample Output: 7 ---------- code ------------ Let ( adjustedText = "�" & text & "�" ; If ( Position ( adjustedText ; "�" & searchValue & "�" ; start ; occurrence ) = 0 ; 0 ; ValueCount ( Left ( text ; (Position ( adjustedText ; "�" & searchValue & "�" ; start ; occurrence ) - 1) + Length ( searchValue ) ) ) ) ) ------------------ Description: In the same way that the Position function provides the number of a character position in a text string, PositionValue calculates the value number of a text string in a return delimited list. Edited October 13, 2005 by Guest
ori_wel Posted October 14, 2005 Author Posted October 14, 2005 Fenton, Wow did that hit the spot! Just perfect. By applying the PositionValue() CF to the result of the AppendNth (a.k.a. GetNthRecord()) CF applied to a self-referencing relationship, I get the local value for the nth related record. Now I can find a single record for each among a group "child" records. Also, finally, no ValueListItems(). Big help! Many Thanks. DSW
Recommended Posts
This topic is 7078 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