Set Data Range on Filemaker after search - filemaker

After searching on Filemaker, I get 100 search results. I would like to get last 10 record only. How do you set a script?

You can use the script step Omit Multiple Records and then enter the number of records you want to omit from the found set, counting from the active record.

Related

search for the last two rows (by date) in Filemaker 19

I have a Filemaker solution that stores measurement data. For a comparison report, I want to extract only the current and the previous rows of a specific set, and export them to XML.
I can easily search, filter and sort them, but how do I tell Filemaker to limit the resultset to a fixed number of rows?
Here is a simple script that reduces the current found set to the last two records. It is assumed that you have already performed a find and a sort. Then you can do simply:
Go to Record/Request/Page [ First ]
Omit Multiple Records [ Get ( FoundCount ) - 2 ] [ No dialog ]
Add a selection field (selected=1 or unselected=0) and mark the last row and the previous row as selected, then do a search for selected field, export the elements you need, then mark all selection fields back to 0. All this executed from a simple script.

Passing Coldfusion query result to Form

I have two Coldfusion templates (getdata.cfm and generate.cfm). The first template getdata.cfm will retrieve from a database with a query, in addition to other tasks. It will retrieve exactly 16 rows of data and each row will have 8 fields. Such as this:
<cfquery datasource="xyz name="lista">
SELECT n1,n2,n3,n4,n5,n6,n7,n8
FROM atable
WHERE product = "abc"
ORDER BY date DESC LIMIT 16
</cfquery>
The second template will generate some random numbers and compare them against these 16 rows. There is a Refresh button on the second template to regenerate the numbers. This is how I would like it to work.
However, right now the only way for it to work is having the database <cfquery> in the second template, generate.cfm That means every time I press Refresh, it will access the database, retrieve the same 16 rows every time, and generate the random numbers. This is not ideal. Because the 16 rows are the same, it makes no sense to retrieve them every time a new set of random numbers get generated. It would be best to get them once, in the first template and somehow pass them to the second template. The 16 sets of numbers will need to be displayed on the screen at all times. The matched and unmatched numbers need to be shown.
How can I pass the whole query result from the first template to the second one without having to pass the 16 records as 16 lists via the form as form fields? Is this even possible? Thanks in advance.
Generate a set of random numbers.
Compare those numbers against a static set of data.
Repeat.
Do you need to do the comparison in the application (CFML) code? Can you generate the set of random numbers and send them to the DB as part of the query in a single request? That way, you get the records from the DB that match your set of numbers and not all 16.
Then every refresh would send the new set of random numbers to the DB, returning only the relevant data.
Alternately, you can use cfquery with the cachedWithin attribute in order to store the results of the query into memory for a specific amount of time while refreshing your random set of numbers.
https://cfdocs.org/cfquery

How can I use Crystal Reports record selection to choose from a list AND included a specific field

I am trying to figure out how to write a formula in the record selector that would allow me to select records in a specified list....but ONLY if there is also a specific record.
In My example. I am pulling earnings codes for employees from specific payroll transactions. For each Transaction date...each employee will have up to 10 codes.
I have my record selection set as this to narrow down the codes I want to see:
{UPCHKD.EARNDED} in ["01", "02", "BNSQT", "BVMT", "CASHBO", "FLAT", "HOL", "HOLPAY", "WAPFML"]
The issue is that I only want to see the first 8 codes IF there is also the WAPFML code. I can't figure out how to tell the record Selector to pick records that have BOTH WAPFML and any of those other 8 codes.
{UPCHKD.EARNDED} in ["01", "02","BNSQT", "BVMT", "CASHBO", "FLAT", "HOL", "HOLPAY", "WAPFML"] and
{UPCHKH.TRANSDATE} in {?Beginning Check Date} to {?Ending Check Date}
I hoped to see only checks where the WAPFML code existed. But I'm obviously returning checks that may not have that code. Using Group selection doesn't work as then I don't see the lines for the other codes.
Assuming you are grouping on {Employee_ID}, Add a group selection formula of MAX({UPCHKD.EARNDED}, {Employee_ID} ) = "WAPFML"
This takes advantage of the fact that "WAPFML" happens to be the largest alpha value in the set. If that is not the case, a more robust approach is to add the UPCHKD table a second time (with an alias), join on same Emp_ID to the first alias, and add a record selection condition on the 2nd alias forcing it to be "WAPFML"
OH I GOT IT! I was grouping by Employee and then transaction date. I entered Maximum ({UPCHKD.EARNDED}, {UPCHKH.TRANSDATE}) = "WAPFML" and took maximum of each transaction date and BOOM. Which now makes all the sense in the world. Thanks so much MilletSoftware for helping me!

Count Unique Values in Found Set

Firstly please allow me to explain what I am trying to achieve. I have a found set of about 100 records, each record has a SKU number (serial) now out of the 100 records, some records have the same SKU, so of course there is less than 100 unique SKUS.
I want to know how many times a SKU appears within the found set. NOT the total number of unique SKUS, but more like how many times each SKU appears individually.
So for example I could have the SKU - 123456 - which appears twice in the found set, so the value for that should be 2, as there are 2 instances of that SKU in the found set.
So just to reiterate, I do not want the total number of unique SKU's in the found set, but more to know how many times each individual SKU appears within the found set.
I have tried many things but keep ending up with the total unique values which is absolutely no use to me.
Thanks
Building on michael.hor257's idea, you can use the GetSummary function to achieve your desired result.
Sample field definition:
After sorting your found set on SKU, this will produce the following result:
use ExecuteSQL filemaker native function to achieve this easily. here is FileMaker article that gives a very good insight:
http://help.filemaker.com/app/answers/detail/a_id/3423/~/counting-the-number-of-unique-values-in-a-field

Perform analysis on last three values of a FileMaker dataset

My end goal is to have a box change color when the last 3 records input into a field (based on the time of input) in FileMaker achieve a certain criteria (ex. variance < 2). I would like to know how to make this happen, or how a calculation/script can be written to only look at the last 3 records.
There are several ways you could approach this. A simple one would be to use a script to:
Show all records in the given table;
Unsort them (assuming they were entered in chronological order; otherwise sort them by creation timestamp);
Omit all records except the last three;
Get the value of a summary field defined as Standard Deviation of your value field;
Set a global variable/field to the square of the returned value.
Then use the global variable/field to conditionally format your "box".
If you don't want to use a script, you will have to define a relationship in order to get the last three values in the table, regardless of the current found set and/or sort order. Or you may use the ExecuteSQL() function for this.