Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

I found a nice way to send an email of a text-based record:


Set Variable ($email, "mailto:"& YourTable::Username& "<"&YourTable::email_address&">?Subject="&YourTabl e::EmailSubjectField&"&Body="&YourTable::Field_A&" ¶"&YourTable::Field_



Open URL [$email, no dialog]

But this only sends the content of one record. Is there any way to send the content of several records, in the body of a single email?

You'll need to be more specific about which "several records" you want, but yes, you can use GetNthRecord and/or a looping script to assemble the contents of many records into a variable that you can use for the body.

Some browsers (e.g. IE) have limits on URL length. Any particular reason you're not using the Send Mail script step instead of Open URL?

  • Author

Thanks for your quick reply, Tom. I want to avoid using the Send Mail script, because we generally use Google Gmail directly from our web browsers.

So here's my situation:

  • I have layout named ClientCalls that contains a portal to a table of our clients' logged phone calls.
  • The Calls table contains the following fields: Calls::ClientName; Calls::CallDate; Calls::CallContent.
  • I want to launch a script (perhaps from a cute little button), from the ClientCalls layout, that will send a single email whose body contains a list of all calls currently showing in the portal, one call per line (each line formatted something like "ClientName/CallDate/CallContent").

Can you guide me as to how I would construct a looping script (or a script with GetNthRecord) to assemble this?

Yours,

Jim Recht

We could just loop through the portal rows, like this:

Loop

Go to Portal Row (Next, exit after last)

End Loop

It's faster though to do it with the GetNthRecord function, but this means we won't have an "exit after last option." But that's OK, we can just figure out how many rows are in the portal and construct our exit strategy around that:

Set Variable($newline ; "%0D%0A" ) // URL can't have carriage returns, so use this

Set Variable($rows ; Count(Calls::CallDate) // be sure to use a field that always has data

Set Variable($i ; 1) // this is our counter

Loop

Set Variable($name ; GetNthRecord(Calls::ClientName ; $i)

Set Variable($date ; GetAsDate(GetNthRecord(Calls::CallDate ; $i))

Set Variable($content ; GetNthRecord(Calls::CallContent ; $i)

Set Variable($body; $body & $name & "/" & $date & "/" & $content & $newline)

Set Variable($i ; $i+1)

Exit Loop If($i > $rows)

End Loop

In your URL you can now use $body instead of YourTable::Field_A.

  • Author

Thanks again Tom.

Two more quick questions:

1) Would I write the script like this:


Set Variable($newline ; "%0D%0A" ) // URL can't have carriage returns, so use this

Set Variable($rows ; Count(Calls::CallDate) // be sure to use a field that always has data

Set Variable($i ; 1) // this is our counter



Loop

Set Variable($name ; GetNthRecord(Calls::Clien tName ; $i)

Set Variable($date ; GetAsDate(GetNthRecord(Ca lls::CallDate ; $i))

Set Variable($content ; GetNthRecord(Calls::CallC ontent ; $i)



Set Variable($body; $body & $name & "/" & $date & "/" & $content & $newline)



Set Variable($i ; $i+1)

Exit Loop If($i > $rows)



End Loop



Set variable ($email, "mailto:"& YourTable::Username& "<"&YourTable::email_address&">?Subject="&YourTabl e::EmailSubjectField&"&Body="&$Body 



Open URL ($email, no dialog)

??

2) Is it legal to define a variable like $i (1) and then re-define it ($i + 1), in the same script?

Yours,

Jim Recht

1) Looks right.

2) Yes, notice how we did the same thing with $body, defining it as ($body & etc.)

It's really helpful to use FileMaker Advanced so you can use the Data Viewer to watch the values of variables and fields while stepping through a script.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.