January 24, 20232 yr Howdy all: The goal is to take the contents of the Notes field from each record in a found set and combine them into one field with a line space between each note entry; it'll then end up as a text inserted into a Send Mail script step. Rather than the traditional way of looping through a found set of records to create this--or even using a Summary (List of) field--I thought I'd try my hand at using the (new) WHILE command but for the life of me I can't figure out how it works even after re-reading Skeleton Key's fine article ( https://skeletonkey.com/filemaker-18-the-while-function-looping-in-calculations/ ). I'd appreciate some guidance in putting it together...or if it's not a good way of doing it with WHILE I'd appreciate input on that, too. Thanks tons, Rich
January 24, 20232 yr 11 hours ago, WF7A said: if it's not a good way of doing it with WHILE I'd appreciate input on that, It may be a good exercise, but since a script is already running anyway, my preference would be to go the "traditional" way, as you call it. A summary field defined as List of Notes should give you the required result directly - unless an individual note can contain returns. Anyway, doing it with While() is fairly simple: While ( [ i = 1 ; result = "" ] ; i ≤ Get ( FoundCount ) ; [ result = List ( result ; GetNthRecord ( YourTable::Notes ; i ) ) ; i = i + 1 ] ; result ) If you want a double space between the notes then change: result = List ( result ; GetNthRecord ( YourTable::Notes ; i ) ) ; to: result = List ( result ; GetNthRecord ( YourTable::Notes ; i ) & ¶ ) ; (but this assumes there will be no empty Notes fields). Edited January 25, 20232 yr by comment
Create an account or sign in to comment