How to retrieve data from related past records - filemaker

I am using Filemaker Pro 12. I want to create a student report that contains results from previous terms. For example, each year there are 4 terms. The report in term 1 contains only the result of term 1. But in term 2, the report contains the results from both term 1 and term 2. This continues until term 4 (end of year) which the report will contain the results from term 1 to term 4.
I created 4 fields ca1_percent, sa1_percent, ca2_percent and sa2_percent in the Results table. My Results table contains all the records of the past results. My relationship graph is shown in the diagram below:
My problem is that I kept obtaining the records (mark_percent) from CA1 only. My fields calculation is shown in the diagram below:
Can anyone help me?
Update:
The result I obtained from above is shown in the picture below. I have populated upto term 3 results.

Just a thought - might an ExecuteSQL() query to fetch the related ids as a value list, then plonking them into a id-1, id-2, id-3 be more flexible?

I solved the problem myself.
Since Filemaker just take the first matched record by default, what I did is to use GetNthRecord(SA1_Results_Match::mark_percent,2) to get the marks for SA1, using 3 to get the marks for CA2 and 4 for SA2.
My TO only need be matched by overall_percent_match which is a calculated field using year & " " & subject & " " & _kf_studentID.

Related

Finding rows with matching id's and the using the date fields in each row to find the time difference in days between them

I have rows of data where up to 3 id's match. I need to try and find the number of days between each of the rows with matching id's using the date field. I am looking to find the number of days between each row in date sequence. So between the first and second row in date sequence, or second and third row but not the first and third row.
So a simplified version of my rows can be seen in the attached image.
image showing 2 ID's with multiple entries. John Smith (highlight yellow) who has 3 entries, two on the same day and one later and Bill Wright who has just two entries on separate days.
The results I would be looking for would ideally be shown in column 4 of the image.
Is there any way I can do this in a formula or pivot table? (basically avoiding VBA) Any suggestions hugely appreciated! Thanks.
This array formula
=IFERROR(B2-INDEX($B$1:$B$9,MAX((A2=$A$1:A1)*ROW($A$1:A1))),0)
will work as long as your data are sorted by date (which your screenshot indicates they are):

Jasper Reports does not find correctly the pages in TOC (table of contents) when there are duplicate titles

I hope you are very well.
Currently I am developing a report be means of Jasper Reports and Java, for doing it I am using two groups, to group the elements of the data source.
DataSoruce returned by the database has the follows structure (it has two columns):
Group 1 | SubGroup A
Group 2 | SubGroup A
I am showing the result in the jasper file with the follows way:
->Group 1
SubGroup A
->Group 2
SubGroup A
Like you can see, there are two groups: Group 1 and 2, and each group has a subgroup, for this example is the same subgroup (SubGroup A).
Every groups were configurated for appearing in the Toc (table of contents report). I used iReport tool, and configured each group to has a Hiperlink and a Bookmark Level. (Groups with 1 Bookmark level and SubGroups with 2 Bookmark level).
Every works fine, the TOC appears correctly and when I select one element in TOC index, the document arrived me to correspondent page, however there is a problem, when the name of Group, or SubGrups, is the same each other (it has already appeared in the TOC, its name is duplicated), the Pdf file does not arrived correct page, takes me to the first page they have that title.
Does someone know how can I solve this problem.
Thanks for your help.
I was able to solve the problem.
1.- I created an variable RANDOM with the expression:
new Random().nextInt(1000)
2.- In the Anchor Name Expression I have called the variable RANDOM and behind it I wrote an *.
$F{TITLE} + "* " + $V{RANDOM}
3.- In the TOC report I added the follows expression each $F{label}, like this:
( $F{label}.contains("*") ? $F{label}.substring( 0, $F{label}.indexOf("*" )) : $F{label} )
And it is all, each title will be a unique name and the index will have the link correct for each page.

How to get the COUNT of rows in Crystal Report

I have a data in database which gives me 8 rows based on date range out of which 5 are HCT, is there any formula in crystal report where I can get that count of those 'Abbr' ?
I am comparing HCT text from Dynamic report selection, I need to know can we create a variable which gives us count of 'Abbr'.
like for
HCT should return 5
US should return 2
RN should return 1 value.
UPDATE 1:
Here is what I am trying to do. I have secondary selection criteria as Dynamic report along with date range.
in the above example I have selected only "HCT", now even though sql data is returning 8 rows (HCT,US,RN) I need only the HCT count i.e. 5.
If I select "HCT" and "US" in the secondary criteria then I should get count of both HCT and US i.e. 5 + 2 = 7.
if I am not selecting anything then it should return 0, so irrespective of the data from DB, the value should be summed based on selection of my criteria.
am I clear enough?
Use Running Totals.
Specifically, make a Distinct Count running total for each Date Range code. You can set a formula in the Running Total Wizard to only evaluate records where, for example, {DateRange} = "HCT"
I found the solution for my question, I am just putting it here so that someone may help for the above mentioned formula.
This is what I did
Created a Formula(not running totals) by name SumOfSkills
if({Command.GlobalSkillAbbr} in {?GlobalSkill}) then 1 else 0
here Command.GlobalSkillAbbr is my "HCT" and '{?GlobalSkill} will contain all Global skills.
and used another formuala to sum it up.
Sum(SumOfSkills)
which gives me desired output.

How to change the value of heading columns based on a parameter

I created a report where I want to show the heading of a column based on a parameter. I tried using both table and matrix format, but I'm unable to reduce year.
year=2013
For example if I choose 2013 in the report this means it will show the last 10 years in the repor, i.e. 2013,2012,2011,2010,2009,2008, up until 2002.
If I understand your question correctly you want to query a database and display the results in a table with a column per year. You can do this by using by using a Matrix object and Column Groups
Add your Matrix object by drag and dropping. Select the Column Group | Group Properties and add a Group Expression.
Use the following code as your Group Expression.
=Year(Fields!Date.Value)
Two fold I'd think:
Alter your sql to accept the parameter and get the bast 10 years in column names 1, 2, etc.
Then use an expression in the header or title similar to =#Parameter!par.Value - Cdec(Data!1.Value) to show headers for 2013 to 2002.
I hope I was clear?

Aggregate not populating chart correctly in SSRS

Below, I've attached a sample of my data as well as a sample of the chart output. I want to aggregate the data and include one row with this number; however, SSRS is just showing multiple of the same value.
In the example below, you'll notice there are 8 rows in Unit 1 and 8 rows in Unit 2, a
total of 13. How can I get Unit 1 to have one row which shows 8 and one row in Unit 2 to show 5? Currently, the expression is =COUNT(Fields!SubID.Value, "DataSet1").
I've also tried adding in a column full of the number 1 which I could use to Sum on, but that produced the same results.
Originally I was doing this all in SQL; that is, producing the exact output I want in SQL and then charting in SSRS. However, this is no longer a viable solution as the end user would like to be able to drill down into the details of the report. I do imagine, if there is no easy way to do this (which I feel like there has to be), that I could write two queries, having one show the report and the other show the details.
Thanks.
The second parameter of your count expression is the problem.
Don't use this:
=COUNT(Fields!SubID.Value, "DataSet1")
Try something like this instead:
=COUNT(Fields!SubID.Value, "UnitGroupName")
The group name should match what is shown in BIDS as the name you've given the grouping, such as under Row Groups.