7 Replies Latest reply on May 4, 2015 2:43 PM by ec324

# Show only the last 30 records in a Chart

### Title

Show only the last 30 records in a Chart

### Post

Hello,

I am a somewhat of a novice and need some help.  I have layout that provides some quick referece charts, each one on a tab.  On one of my charts I want to show only data from the last 30 records.  I have multiple y-axis data series.  Is there a way to use a calculation in conjunction with  a count function to limit my data to only the last 30 records?

• ###### 1. Re: Show only the last 30 records in a Chart

How is the data organized for the chart? In a field as a list of delimitted data? Separate records in the layout's found set of records? Or as separate records in a related table?

• ###### 2. Re: Show only the last 30 records in a Chart

Hi, thanks for the quick reply.  I don't know exactly how to answer this but here is my setup.  I have a table setup to anaylze aggregate material from our pits.  There are nine tests performed on each sample, thus I have nine fields in the table for the user to enter the results.  I then have created a line chart to show my trends.  I have set the x-axis as the date the data was entered and the y-axis has each of the nine fields as a data source for the current found set.  I would like the chart to still show the date in the x-aixs but limit it to the last 30 records.  Do I need to enter each field in the y-axis with a formula to only pull the last 30 records and if so how.

Thank you kindly

• ###### 3. Re: Show only the last 30 records in a Chart

and the y-axis has each of the nine fields as a data source for the current found set

That's the key detail I was looking for. If you limit your found set to the most recent 30 records, you have limited your chart to the most recent 30 sets of data points for your chart.

There are a number of manual and scripted methods you can use to remove all records but the most recent 30 from your found set.

You can perform a find that finds all records dated with the date of the oldest record of the 30 or later.

You can use omit multiple to omit (not delete!) all records except the last 30

• ###### 4. Re: Show only the last 30 records in a Chart

Ok, that is what I thought.  So to take the omit path rather than find, I am not sure, do I enter every data point as a formula using an omit command? The reason for this is I do not want the user entering the find mode.  As they are entering data I have a series of charts that are for quick reference and limited data to provide instant feedback in case of anomalies in teting procedures.  So most charts are delimited and generate as the user enters the data for only that record.  However, this chart, as mentioned, is the past 30 records in the hopes the user will spot problems in a 30 record trend, including the record they just finish entering.

• ###### 5. Re: Show only the last 30 records in a Chart

This is not something you do in chart set up. You do it in browse mode, either manually by selecting these options from the records menu or by running a script that does it for you.

Here's a script that will omit all but the last 30 records in the found set.

Sort [Restore ; no dialog ] //sort by a field that puts them in order with most recent records listed last
Go to Record/Request/Page [first]
If [ Get ( FoundCount ) > 30 ]
Omit Multiple Records [no dialog ; Get ( FoundCount ) - 30 ]
End IF

• ###### 6. Re: Show only the last 30 records in a Chart

Awesome, that will work out perfectly!

Thank you so much for your time!!!

• ###### 7. Re: Show only the last 30 records in a Chart

Is there a script to add the records that we omitted back in? I'm trying to graph the top 10 records (out of 60) by 3 different fields so I think I need 4 scripts (1 sorted by field a, 1 sorted by field b, 1 sorted by field c, and 1 to reset).