If you are basing your chart on the found set, you would need to limit your found set to only data from the last 30 days. You can perform a find for all records in that date range before viewing the chart and this can be scripted.
There are also ways to limit delimitted data to the last 30 values by using the RightValues function if delimitted values are being used as the data source.
Thank you for the answer, I don't have much experience with Filemaker Pro.
Can you post a link where I can see samples of the query/code to do this.
Thank you, DPP
I first need to know which option you are using for your y-series: Delimited data or a found set?
I try using the "specified calculation" to reduce the number of records to only the last 30 entries but nothing i do makes any difference, at this point I want to learn how to do the above two. Is Using the Specified Calculation considered Delimited Data. Sorry I am very very new to this.
I have my main table called stats and a portal tool for my table statsvalue showing all the linked records to that main table, on the side I have my line chart.
The X (horizontal) is my sqldate field and the vertical are the values field, as you can see on the screen shoot I uploaded that I get all the records showing on the chart. Thank you for your help
The simplest option is to modify the portal's relationship to only match to the records you want to see in the chart. This might require adding a new table occurrence to your relationship graph if you need the existing relationship for other purposes.
Let's say that your existing relationship is:
ChartTable::MatchField = MainTable::MatchField
If you modify the relationship to be:
ChartTable::MatchField = MainTable::MatchField AND
ChartTable::DateStart < MainTable::Date AND
ChartTable::DateEnd > MainTable::Date
You can set up DateStart and DateEnd on your layout and control what data appears in the chart by selecting different start and end dates in those fields.
Hello and Thank you for the answer - I will work on as a separate database so I keep this a bit more organise.
Since my last post I was able to work out a solution, Here is what I have done, Please let me know if this is completely wrong (It seems to work).
I have created a new Layout.
I have switch the tables, The "main Table" is the one being open in the portal Tool, so all my search result from "StatsValue" are now part of Current Found Set (Before this was not possible as my main table seem to be the one determining the Current Found Set)
I have created a layout script Called "StatsTest"as Follows:
1. Enter Find Mode [Restore] (StatsValue::sqldate:[>= 01/07/2013]
2. Go to Layout ["StatsTest"(StatsValue)]
3. Sort Records [Restore, No Dialog] ) -->sort ascending.
On the Layout - I have set up a script Trigger for:
1.OnLayoutEnter - Script "StatsTest"
2.OnModeEnter - Script "StatsTest" -> This keeps my Layout constantly on search (only search and display the chart.)
-----I ONLY HAVE ONE PROBLEM-----
My chart shows the wrong order, I can not seem to be able to make the chart follow the Ascending order, with the oldest date on the left and the newest on the right as per the script.
I also enter the Order as ascending on the table relationship but does not change, all my searches show as descending. (Any Suggestion? or this entire approach to solve the problem is completely wrong?.
Specifying a sort on the relationship will not affect the sort order of your found set.
If you use table view to examine the records in your found set do you see them sorted in ascending order by the date field?
What I see in the chart suggests that your found set is actually sorted in Descending order.
And you may find these scripted find examples helpful as a way to avoid needing to redefine your script when you need to see data from a different date range on your chart: Scripted Find Examples
Thank you for the link.
Your Help is very much appreciated.
I adjusted my Script Triggers in the Layout and created a new script called "Sort" (Sorts my date ascending) and added to the
layout script trigger as OnModeExit - Script "Sort" and it is sorting my chart in the right order.