AnsweredAssumed Answered

How do I create a "Top 100" report?

Question asked by MikeTV on Feb 25, 2009
Latest reply on Feb 25, 2009 by comment_1


How do I create a "Top 100" report?




Newbie to FM9 (ex DataEase) needs some guidance.


TABLE_A contains a couple of thousand records which have uniqueness on IDField. Another field (CountField) contains a count of related records in TABLE_B (one to many relationship). 


I have created a simple report which lists the records in TABLE_A in descending order sorted by Countfield. I opted to have a script auto created by the FM report wizard, so I can re-run the report at will. So far so good.


What I now want to do is limit the number of lines contained in the report to just 100, rather than outputing all (2000+) records in TABLE_A. Effectively, I want to create a top 100 report.


In an attempt to find a way of doing this, I have added a Summary field to TABLE_A. This field is called RecordCounter and is set to provide a running count of IDField. I have temporarily added this to the report layout so that I can see it incrementing correctly, which it does.


What I have not been able to do is find a way of limiting the quantity of records to 100 by using this running count field within the script.


Ideally, I would prefer not to have to use a summary field at all. I feel that I ought to be able to use logic steps within the script to limit the number of records that are output, possibly using a variable that increments each record until 100 is reached, then stops the script. However, the solution is eluding me.


Any help, as ever, will be much appreciated