June 18, 201411 yr Hi all I think I have this custom function in every database I use. Case ( Start < Number ; GetNthRecord ( field ; Start ) & ¶ & AppendNth ( field; Start + 1 ; Number ); Start = Number ; GetNthRecord ( field ; Start ) ) It is just standard practice for me to use it. I mostly use it to concatenate data from Portals into a single field for display. As it only concatenates one field, I usually create a calc of all the fields I want to display and then use AppendNth ( relate::field ; 1 ; Count ( relate::recid ) ) Is there a better way? It just occurred to me this afternoon, that I just automatically use the FM7 custom function. Is there an inbuilt function that I have overlooked? I am sure I could achieve this with ExecuteSQL too. Thanks in advance. ZP
June 18, 201411 yr I am guessing this custom function predates the List() function introduced in version 8.5.
June 18, 201411 yr or the ExecuteSQL() function; using this you can avoid any and all intermediate calculations.
June 18, 201411 yr Author The one good use for this function, which we used today was to list the foundset .. I don't think I can do that with the List function. I have started to use the ExecuteSQL function for the related records now. A little off topic but can you ORDER BY a value list in ExecuteSQL. Thanks for responding. ZP
June 18, 201411 yr to list the foundset .. I don't think I can do that with the List function. If you are using version 13 (please update your profile), you now have a summary field for that. Incidentally, I am puzzled why would you prefer a text field for displaying your records over a portal or a list view - where records and fields can be individually selected, clicked, formatted and whatnot.
June 18, 201411 yr Author It is mostly for merging to Word or displaying in a webviewer with other data from the systems.
June 18, 201411 yr A little off topic but can you ORDER BY a value list in ExecuteSQL. Sure. If you want to get up to speed quickly, read this: http://filemakerhacks.com/2012/10/19/the-missing-fm-12-executesql-reference/
June 18, 201411 yr Where does that describe ordering by value list? Seems to describe only standard order by operations.
June 18, 201411 yr You could create a new function that's similar to the old, passing a second field as an additional parameter. Case ( Start < Number ; GetNthRecord ( field1 ; Start ) & " " & GetNthRecord ( field2 ; Start ) & ¶ & AppendNth ( field; Start + 1 ; Number ); Start = Number ; GetNthRecord ( field ; Start ) ) Personally, I try really hard to avoid adding fields. Where does that describe ordering by value list? Seems to describe only standard order by operations. I think the OP meant one can "ORDER BY a *list of values* in ExecuteSQL".
June 21, 201411 yr Author Thanks David. That looks good. How so? With regards to merging. If for example, I have a related table of fees for a product, I will append them as one field and export that for the merge. If I export the related fields, I can insert the single merge field.
June 21, 201411 yr With regards to merging. If for example, I have a related table of fees for a product, I will append them as one field and export that for the merge. If I export the related fields, I can insert the single merge field. I am not sure I understand the advantage here. If you have multiple related records, and you export them as a list, you will end up with vertical tab character as the delimiter - does Word know how to handle this? My policy is to never add anything to the solution for the sole purpose of export; I farm it all out to XML/XSLT.
Create an account or sign in to comment