Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5170 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Is there a way for a script using Copy All Records[] to reliably identify all of the columns that are copied from an arbitrary layout? Fields <> onto the layout are included in the copied data but are as yet a mystery.

I want to provide for my users the Copy All Records menu item/Script Step with a few improvements.

To make it easier to use without having to hit Alt/Option, I have added a menu item "Copy All Records" to the Edit menu.

My implementation has the following features.

(1) No global fields are copied (and no containers)

(2) I can control via a script to omit fields named in a certain way (i.e. fields I use for user interface features)

(3) The first line of the copied text contains the names of the fields.

(4) This script works on any layout in a solution with many tables with no special setup. Layouts can be edited without breaking the script.

(5) The auto-assigned serial number for the record is automatically included as the first column of the copied data. (The name of this serial number field is always "_kp" & the table name & "_id".)

I have implemented a version of this in a script, but it is very slow. My current script loops over the records in the found set and builds the result. It uses the FieldNames() function and GetField(). It works as desired, but it is far too slow and provides insufficient user-feedback (e.g. progress bar).

I'd like to figure out a way to accomplish the above requirements using the built-in Copy All Records script step since it is relatively speedy and provides a built-in progress bar when it does take some time.

With a custom FileMaker plug-in I have all the tools I need to manipulate the text to remove the undesired columns of info from the built-in Copy All Records step. The problem I have run into is that there is no way to identify all of the data that is copied. Fields are easy enough using FieldNames(). Determining their order can be done with FieldBounds(). The problem is that the Copy All Records script step also copies fields merged into text boxes (<> fields). I have no way of either auto-generating a heading label for these or identifying and removing that column from the output.

-Tom

Posted

What are users doing with the records on the clipboard?

I presume they would paste into a spreadsheet or similar. Many of my userbase likes to analyze the data in their own ways.

Why not a custom layout for each table that contains just the fields you want copied?

I don't want to maintain a separate layout to mirror each layout. That's too much work to keep up to date in the long term.

It is a successful way technically to achieve what I'm after though. I used to do this, but as the project became much larger, it added too much to the overhead.

Posted

Why not a scripted export (merge or .xls)?

I suppose that could work if a few technical details could be ironed out.

(1) How do you export all of the fields on an arbitrary layout? FieldNames() will tell you what's on the layout, but the FileMaker scripting engine doesn't let you programmatically specify what fields to export.

(2) How do you get the contents of the exported file into the copy/paste buffer?

Posted

Does anybody know how to reliably determine what columns of information are provided when using the script step Copy All Records?

In particular is there a way to predict in which column of the copied data any <> fields are found for an arbitrary layout?

Posted

This makes me think of the technique where a list layout is offered, and the use can pick the fields to display (the header contains several global fields. Each global uses a value list of field names). Don't know if this technique is online, but it's in the FM10 Bowers book. Ray probably has something similar.

Posted

This makes me think of the technique where a list layout is offered, and the use can pick the fields to display (the header contains several global fields.

A few of the layouts in my solution use this technique of presenting a choice of columns to display in a list. Those situations are among the few that are handled in a non-portable way. The values work seamlessly, but the header labels are handled specially in the Copy All Records wrapper script.

This topic is 5170 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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