john9210 Posted July 5, 2007 Posted July 5, 2007 I'm using FM 8, Win Vista. I'm having a lot of difficulty using Getsummary functions. I need to use them because I need to calculate values based on Summnary fields. For example, can they be used in trailing grand summary parts? Sometimes they appear to calculate properly, other times not. I've attached a complete description of the program I'm preparing as well as screen shots in layout and browse modes. The only issue is with the TaxCredit calculation. It does not work correctly in either the subsummary or training grand summary parts. It does use the related field TaxRate and I wonder is this causes a problem with Getsummary calculations. Program_to_calculate_the_tax_on_Gasoline.pdf
Vaughan Posted July 5, 2007 Posted July 5, 2007 I just use normal Summary fields in leading and trailing summary parts. Have you tried them?
john9210 Posted July 5, 2007 Author Posted July 5, 2007 I found the answer. I was using the wrong occurrence table for the TaxCredit related field! Makes me feel dumb Now, my final question is how can I get the total of TaxCredit for display in the Trailing Grand Summary. The problem is that TaxCredit is computed with GetSummary fields and I therefore can't use a summary field or GetSummary field to calculate the total. Or can I? John
Søren Dyhr Posted July 5, 2007 Posted July 5, 2007 No you would always be in a record after sorting, this means the global will recieve the avarage from state that comes first in the sort order! The scripted GetSummary( will pick the subsummary you're in! As I understand your field definitions, would I instead use GetNthRecord( in two recursive calc's to make the avarage you need in the global field: http://www.briandunning.com/cf/439 Now the delimiter is a ¶ but should be a + instead, so change the CF accordingly, the two strings is then put inside each thier own Evaluate( -statement. If you're absolutely sure you need to summarize all records, not just a found set. Could instead use List( over a cartesian relation, and then Substitute( the pilcrows with plusses, to make the Evaluate( work! --sd
john9210 Posted July 5, 2007 Author Posted July 5, 2007 Thanks, I would like to give it a try. But using GetNthRecord is beyond me.I hope you can give me a better explanation. I do want to summarize the records in the found set. John
Søren Dyhr Posted July 5, 2007 Posted July 5, 2007 Alright I've made you a tiny template, with the simplest CF I can think of, however will you need to get a tail-recursion'ish if you need to summarize beyond 10000 records. --sd SummarizeViaEvaluate.zip
comment Posted July 5, 2007 Posted July 5, 2007 I may be missing something here, but it seems to me a "native" solution (i.e. using summary fields and summary calculations) should be possible here. I am puzzled why the average needs to be scripted, instead of using a summary field defined as Average. Perhaps a demo file showing the original problem would be useful.
Søren Dyhr Posted July 5, 2007 Posted July 5, 2007 The avarage is needed in a global field, but yes why??? --sd
john9210 Posted July 5, 2007 Author Posted July 5, 2007 Thanks for the file. One question. What is the GrapNumbers function in the Evaluate function? John
Søren Dyhr Posted July 5, 2007 Posted July 5, 2007 Ah! Thats the CF, but I then see that you can't develop CF's with you version of Filemaker. But the CF is going this way: Case( Found > 1; GetNthRecord(Field; Found) & "+" & GrapNumbers(Field; Found - 1); GetNthRecord(Field; 1) ) Which you obviously then can't use - sorry, instead should you perhaps use some of this: http://www.kevinfrank.com/download/kf-fast-summary.zip --sd
john9210 Posted July 6, 2007 Author Posted July 6, 2007 I've just upgraded to FM 8.5 Advanced. Does that make a difference?
Søren Dyhr Posted July 6, 2007 Posted July 6, 2007 (edited) OK, then I guess I'll just shut up then Oh no! It's been nagging me as well, neither can I see the purpose for the avarage there, only I would know how to do it if it really is manditory. My guess however is probably like yours that the utilization of the some of the other options (I've drawn a red box around in the image above) in the summary field def' have been ignored??? Usually is it only Fenton and you, who can get away with the use of globals, when I begin to scrutinize suggestions --sd Edited July 6, 2007 by Guest
Søren Dyhr Posted July 6, 2007 Posted July 6, 2007 Yes it does, then would I like to turn your attention to: File>Define>Custom Functions... ...when inspecting my template! --sd
comment Posted July 6, 2007 Posted July 6, 2007 The only thing I have suggested is to better define the problem, so it can be solved using paper and pencil first. I am quite sure I cannot do this by following the description attached to the original post, because when I do, I always end up with NetTaxableFuel = 0. So obviously something is missing. I am guessing each trip has, in addition to Miles, a TaxableMiles attribute (and I suspect that "NetTaxableFuel" should actually read "NonTaxableFuel"). I believe that once you put this in place, it can be all done with a couple of summary fields and some calc fields using GetSummary(). I am amazed by the amount of techniques you have a suggested as an alternative - to what?
Søren Dyhr Posted July 6, 2007 Posted July 6, 2007 I am amazed by the amount of techniques you have a suggested as an alternative - to what? LOL! The only thing I have suggested is to better define the problem Since we usually are spoiled rotten with such extravaganza! --sd
Leb i Sol Posted July 26, 2007 Posted July 26, 2007 Sorry to jump in but rather than a new topic.... Is it possbile to sort based on on vaiables (count or amount) prior to setting the "output" field? New to creating any custom reports other than 'builtin' featureset of FM....sorry if it is obvious question. Thanks for your time! using example linked up: http://www.kevinfrank.com/download/kf-fast-summ ary...
Recommended Posts
This topic is 6331 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now