tmas73 Posted April 23, 2008 Posted April 23, 2008 Is there any way to display portal fields in a <> text or a text field?
Lee Smith Posted April 23, 2008 Posted April 23, 2008 (edited) If this isn't a trick question, of course you can. Have you tried it? Edited April 23, 2008 by Guest
tmas73 Posted April 23, 2008 Author Posted April 23, 2008 If this isn't a trick question, of course you can. Have you tried it? Sorry, maybe I have to change my question. Is it possible to display all the portal rows in a <> or text field?
mr_vodka Posted April 23, 2008 Posted April 23, 2008 Try creating a calc on the parent side of List ( PortalRelationship::yourField ) then use that as a merge field.
tmas73 Posted May 8, 2008 Author Posted May 8, 2008 Try creating a calc on the parent side of List ( PortalRelationship::yourField ) then use that as a merge field. I was trying the suggestion but I run into problems maybe because the "Product" field I like to display from the portal comes from a third table. Table 1 Portal with "Product Field" ----Links to---- Table 2 Records from Portal incl. a relation field "Product" from Table 3 ----Links to---- Table 3 All records on available "Products" So you think this is my problem? If so how can I get the portal "products" into a merge field? Thanks
mr_vodka Posted May 8, 2008 Posted May 8, 2008 List ( Table2::ProductID ) will return all the product IDs. Create a new Table Occurrence to Table 3 keyed from the calc field to the ProductID field in table 3. List ( [color:green]Table3 2 :Product Description) in a new calc will return all the descriptions.
tmas73 Posted May 9, 2008 Author Posted May 9, 2008 List ( Table2::ProductID ) will return all the product IDs. Create a new Table Occurrence to Table 3 keyed from the calc field to the ProductID field in table 3. List ( [color:green]Table3 2 :Product Description) in a new calc will return all the descriptions. Cool got it to work thanks for the guides. Here is the problem though, I did not think about it ether so I did not mention it. On Table one, in the portal I have the oils, that list fine, but I also have a field from table to that displays weight. So how can I create the calculation that lists the oil and the weight of the oil too? How can this work? Thanks
mr_vodka Posted May 10, 2008 Posted May 10, 2008 List ( Table3 2 :Product Description) & " - " & List ( Table3 2 ::Product Weight) ??
LaRetta Posted May 10, 2008 Posted May 10, 2008 (edited) Wouldn't this produce a list of products THEN the list of weights? I admit to being lazy (just woke up) so I haven't put much deep thought into this response. But I would think, from products table, a concatenated calc of Product Name & " - " & ProductWeight might be what is wanted? UPDATE: Oh, then of course from parent use as John suggested: List ( Products ; thisCalc ) Edited May 10, 2008 by Guest
comment Posted May 10, 2008 Posted May 10, 2008 A custom function along the lines of the one here: http://www.fmforums.com/forum/showpost.php?post/267809/ might be useful here, to eliminate the need for the interim calculation.
mr_vodka Posted May 11, 2008 Posted May 11, 2008 (edited) Yes if you want it to return to return side by side a concat field would be used. I wasnt understanding what he wanted hence the '??'. He stated that he wanted a list of all the oils and then weights in one list, so I seperated the two lists with a hypen seperator. You are probably right though in what he was looking for. * Edit - after re-reading it, I dont know how I misinterpreted it. A little slow I guess. :crazy: Edited May 11, 2008 by Guest added PS
Ugo DI LUCA Posted May 11, 2008 Posted May 11, 2008 Hi, Even without any concanated field, you may use the CustomList CF http://www.briandunning.com/cf/747 CustomList ( Start ; End ; GetNthRecord ( FirstField ; [n] ) & GetNthRecord ( SecondField ; [n] )" ) or better using named objects fro your fields, and then respecting your *portal sort order* CustomList ( Start ; End ; "GetLayoutObjectAttribute ( ""ObjectName1"" ; ""Content"" ; 1 ; [n] ) & GetLayoutObjectAttribute ( ""ObjectName2"" ; ""Content"" ; 1 ; [n] )" ) Start and End may be calculated values, ex Start = 1 and End = Count ( relation::ID )
LaRetta Posted May 12, 2008 Posted May 12, 2008 Even without any concanated field, you may use the CustomList CF You probably missed Michael's suggestion of eliminating the interim calculation using his CF? :wink2:
Ugo DI LUCA Posted May 12, 2008 Posted May 12, 2008 (edited) No, I don't think so. - First because GetNthRecord ( ) is sensible to the sort defined in the Define Relationship dialog, thus not following the portal sort order in this case ( if needed ). - Second because this is a concanation of all of one field's values in the related set, or I missed it. Any lights appreciated here. What am I reading ? PS ok, Michael was saying "along the lines" so may be he was thinking of doing the concatanation through the recursion. Edited May 12, 2008 by Guest See PS
comment Posted May 12, 2008 Posted May 12, 2008 this is a concanation of all of one field's values in the related set That's why I said "along the lines of". I thought the required adaption was pretty obvious: ListSet2 ( fieldName1 ; fieldName2 ; startRecord ; endRecord ) Let ( [ item = GetNthRecord ( fieldName1 ; startRecord ) & " - " & GetNthRecord ( fieldName2 ; startRecord ) ] ; Case ( not IsEmpty ( item ) ; item & ¶ ) & Case ( endRecord > startRecord ; ListSet2 ( fieldName1 ; fieldName2 ; startRecord + 1 ; endRecord ) ) ) GetNthRecord ( ) is sensible to the sort defined in the Define Relationship dialog, thus not following the portal sort order in this case ( if needed ). I would wait until the 'needed' part is clear before suggesting a sort by custom function. These things are slow.
Ugo DI LUCA Posted May 12, 2008 Posted May 12, 2008 Yep, that's what I understood afterwards. About the sort, if it's based upon the portal sort order, using objects rather than fields, it's not that long. And CustomList is not recursive. That's why I suggested it.
comment Posted May 12, 2008 Posted May 12, 2008 Any sort other than Filemaker's native sort is slow. CustomList is not recursive, but I am not at all sure it makes a significant difference. Regarding using objects instead of fields, and following the portal rows: it's a neat idea, but it needs to be pointed out that the calculation is tied to the layout objects and depends on their existence.
tmas73 Posted July 8, 2008 Author Posted July 8, 2008 (edited) Hello, so I created a Custom Function with the provided script. The newbie question of today: What should I put for startRecord and endRecord? My current calculation is: ListSet2 ( oil_quantities::oil_name ; oil_quantities::oil_weight ; startRecord ; endRecord ) Thanks Edited July 8, 2008 by Guest
comment Posted July 8, 2008 Posted July 8, 2008 Try: ListSet2 ( oil_quantities::oil_name ; oil_quantities::oil_weight ; 1 ; Count ( oil_quantities::YourMatchfield ) )
tmas73 Posted July 8, 2008 Author Posted July 8, 2008 Try: ListSet2 ( oil_quantities::oil_name ; oil_quantities::oil_weight ; 1 ; Count ( oil_quantities::YourMatchfield ) ) Thanks comment So I try to understand what are StartRecords or in this case now "1" and end record, now "oil_quantities::YourMatchfield" stand for? Is it the record count, how many records are in the database? quantities::oil_name = Oil Name oil_quantities::oil_weight = Oil Weight 1 = increment of one? YourMatchfield = ?
comment Posted July 8, 2008 Posted July 8, 2008 If you want the function to get data from ALL related records, you need to tell it to start at the first record, and end at the last one. So the startRecord parameter is 1 (the number one), and the endRecord parameter is the count of related records (or found records, if you're working with local fields). To count related records, you count any field that cannot be empty. The matchfield used for the relationship is one such field.
tmas73 Posted July 8, 2008 Author Posted July 8, 2008 (edited) Understand, thanks comment! I would also assume just to add additional fields to the function in order to show units or such. Right? Confirmed! Is there a way of formating the result better? At this time it looks like this Coconut - 340 - 373.33 Palm Oil - 170 - 186.68 but I wanted to add a unit field and some tabs to make it read better. Coconut - 340g - 373.33g Palm Oil - 170g - 186.68g Edited July 8, 2008 by Guest
comment Posted July 9, 2008 Posted July 9, 2008 You can shape the returned rows to anything you want - by modifying the definition of 'item' in the function.
Recommended Posts
This topic is 6038 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