Flowfield formula

I think I have posted a similar question previously, but couldn’t find it…So here again:

In a table I have the field date1 (type Date), how can I create a flowfield with a filter like this:

date1 > CALCDATE(’-1Y’,PlejeplanRec2.Start)

If you only want to show the calculated value on an form:

Write a function “CalcMyValue” for your SourceTable and put the function-call as SourceExpression on your form (only “CalcMyValue”).

If you want standard flowfield behaviour you can make something like:

  1. add a new field “StartPreviousYear” (make it editable = no) to the table with your field “Start”
  2. Add “StartPreviousYear := CALCDATE(’-1Y’,PlejeplanRec2.Start)” to the OnValidateTrigger of your field “Start”.
  3. Make your flowfield with the filterexpression Date > StartPreviousYear
  4. (Make sure you call the OnValidate-Trigger - not only assign the date :wink: )

forki

I dont think thats the solution I’m looking for…I guess there’s a trick with the ‘ValueIsFilter’ option but I don’t remember how…??

Okay, stab in the dark here, because I am not 100% sure what you are trying to achieve.

In the flowfield, calcformula you would set a DateFilter field (FieldClass FlowFilter) against the Date field in the Sub Tables. You may need to create a new field.

Then from the header record you would apply a filter to the Datefilter.

Setfilter(Datefilter,’>%1’,CALCDATE(’-1Y’,PlejeplanRec2.Start));

Calcfields(“Flowfield”); - Replace Flowfield with the name of your flowfield

Then your flowfield would have the Date Filter applied to it as well.

As an example have a look at the Nominal Ledger (Chart of Accounts). Click on the FlowFilter button (Shft+F7) and add a date filter, something like >010101 and you will see that the Net Change field will change. You can look at how this works to replicate.

If this is way off the mark of what your trying to achieve let me know, re-phrase the question and I’ll have another stab!

Hi Tony

NO, thats not the solution either:-) Let me re-phrase the question: In a table I have 2 fields Amount and Date1. Now I want to make a FLOWFIELD giving me the sum of the field Amount of alle the records where Date1 is later than CALCDATE(’-1Y’,PlejeplanRec2.Start). My question: How can I set up a calcformula (I guess I have to add a field or 2 to the existing table)?

Um, I think thats what I just told you.

If you are trying to flowfield of the same table, then you should really look at using a Calcsums instead. As long as your sift is set correctly with the key that would work fine, along with the filters I suggested above.

Table.Reset;

Table.setfilter(Date,’>%1’,Calcdate(’-1Y’,plejeplanRec2.Start));

Table.Calcsums(Amount);

MyNewAmtField := Table.Amount;

Okay I missed the > than sign. opps [:|]