Jump to content

To limit the number of displayed found records.


Yorch

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

Recommended Posts

The result of a specific search through the database, comes up with, so to say, 27 found records.

Now...is there a way to limit the output of "found records" to a user defined number, lets say to only 3 or 10 records?

Any idea on this :

Yorch

Link to comment
Share on other sites

Ignoring for the moment which records to show of the actual found set, I can think of two ways. 1) Run a looping script to omit records until the desired number in the found set is reached or 2) add unique records ID's to a global used for the left side of a relationship until you've added the appropriate number then perform a Go to related record (show).

-bd

Link to comment
Share on other sites

An option is to develop a complete browser solution.

There are some things which are just plain easier to handle this way. Your situation is one of those. It is handled in a browser solution quite simply with the use of the cdml tag -max e.g. -max="3". If you wanted to show every 9th record you might use &-skip="9"&-max="3".

Link to comment
Share on other sites

Let me be more specific:

These 27 found records are already sorted, so that the first one in the display is the more significant and the last one the least important. I am exporting these records to an HTML file, which in time, will be attached to an e_mail.

So far this works pretty good... the one thing I need to do now, is to limit the exporting records procedure, so that I can have the exported HTML file built up with only the first 3 or the first 10 records (of the found records set)

I am quite new to FM so, Keith what do you mean with "cdml tag -max e.g. -max="3". " :

Thanks for helping

Yorch

Link to comment
Share on other sites

I'm not quite sure what you are doing. Ultimately you intend to send someone an email. But in the process you are "... exporting these records to an HTML file"

There are basically two ways to serve FMPro over the web, Instant Web Publishing (wysiwyg in that all "browser" code is generated by FileMaker) and Custom Web Publishing (you write the solution for both the database(s) and the "browser" code.

"Browser" code for FileMaker is a combination of html and cdml (Claris Dynamic Markup Language), and which, like html, is not case sensitive. cdml is what Web Companion reads for database connectivity. Using cdml one does not need to write cgi as that is built into Web Companion. And when one adds cdml to an html file it is known as a format file.

The tags (variable, replacement and action) used in cdml (e.g. -max and -skip) are available from the FileMaker website. Look for something about the "cdml reference database". That is what you want to help you understand the tags necessary to publish FileMaker in custom solutions. You may also find the "cdml tool", but it is rather useless (imo) and easily can lead you down the wrong path.

Simply put, the cdml tags are what help you handle the data, from creating new records to displaying found sets or portals to editing. They provide a whole lot of design versatility.

While we often refer to ourselves as "developers", our development of solutions is another way of saying we design solutions. As a design example, for the database interaction with the web, it is usually ok to have just one layout per db on which all fields for the web solution must exist. In other words, there is no need to design a fancy layout since it is going to be read by the machine's interacting with the network, not by the clients. For browser solutions we design format files instead of layouts. Not having to navigate between layouts means less load on the database.

You do need to keep in mind that browser solutions are "stateless" and that the contact by the client with the databases is not continuous as in a peer-to-peer solution. This can easily work to the designer's advantage.

Also, for serving browser solutions with FileMaker 5.0 and higher, you will need FM Unlimited. All the other editions 5.0 and higher limit the number of clients in a 24 hour period to a very impractical number.

Link to comment
Share on other sites

Hello Yorch,

What you are trying to do can be achieved if you write a script along the lines of the following:

If ["Status(CurrentFoundCount) > 10"]

Loop

Exit Loop If ["Status(CurrentFoundCount) = 10"]

Go to Record/Request/Page [Last]

Omit Record

End Loop

Export Records [Restore, No dialog, "Attachment.html"]


Prior to setting up the script, you should run an export manually, selecting the "HTML table" export format and setting your field order as desired for the files you want to send as email attachments. These settings will then be saved with the Export Records step in your script.

Then if the found set is ten records or less it will be exported as is, but if it is larger, it will be reduced until only the top ten records are left (according to whatever sort order you've applied) and then those ten records will be exported.

Link to comment
Share on other sites

That is from the most hilarious English soap opera called 'Allo 'Allo.

French Resistance Leader -- Michelle -- is using that sentence in Harryk's signature before she will say something.

I will say that 'Allo 'Allo is better than 90% of US soaps. On level with Taxi and Soap.

Link to comment
Share on other sites

This topic is 7889 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.