Flowfield all the same

MauddibMauddib Member Posts: 269
edited 2006-03-03 in Navision Attain
I have a flowfilter on another table which looks at another table. The Calformula is made up of fields and flowfilter fields. And is made up of store number, date, type etc. The quantity field is being summed.

A similar example would be if i was looking at the purchase lines table and was filtering on type, item no. date

However for each store/date/type the values are all the same. So the quantity for:

Store1 31/12/2005 type1 is 20 and Store2 31/12/2005 type1 is 20.
Store1 31/12/2005 type2 is 110 and Store2 31/12/2005 type2 is 110.

So its as if its ignoring the Store filter but not the rest!!! Any ideas why? Is it something to do with keys on table being looked into?

GaMBe

Comments

  • DenSterDenSter Member Posts: 8,307
    The flowfield definition must include the store as a flowfilter, and the table that you sum must have the Store number as a key field in order to correctly sum the sumindexfield.
  • krikikriki Member, Moderator Posts: 9,112
    And if you use the flowfields in the program, you need to filter it like this:
    (e.g. on item-table):
    recItem.GET('10000');
    recItem.SETFILTER("Location Filter",'BLUE');
    recItem.CALCFIELDS(Inventory);
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • MauddibMauddib Member Posts: 269
    I cant figure it out. I have a field on one table thats a flowfield with the following calc formula....

    Sum("Payment"."Amount Tendered" WHERE (Type=FIELD(Code),ID=FIELD(ID Filter),Terminal=FIELD(Terminal),Date=FIELD(Date Filter),Store No.=FIELD(Store Filter),Time=FIELD(Time Filter)))

    The Payment table has the following Secondary key with Amount as its sumindexfield:

    Type,Date,Store No.,ID,POS Terminal,Time

    But its not working at all. Ive looked at the Item table and other examples of the same thing being done and I cant see anything wrong or different.
  • krikikriki Member, Moderator Posts: 9,112
    Mauddib wrote:
    I cant figure it out. I have a field on one table thats a flowfield with the following calc formula....

    Sum("Payment"."Amount Tendered" WHERE (Type=FIELD(Code),ID=FIELD(ID Filter),Terminal=FIELD(Terminal),Date=FIELD(Date Filter),Store No.=FIELD(Store Filter),Time=FIELD(Time Filter)))

    The Payment table has the following Secondary key with Amount as its sumindexfield:

    Type,Date,Store No.,ID,POS Terminal,Time

    But its not working at all. Ive looked at the Item table and other examples of the same thing being done and I cant see anything wrong or different.
    For the different values, before doing the CALCFIELDS, you put a filter on "Store Filter"?
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • DenSterDenSter Member Posts: 8,307
    Also you need to put the fields in your calcformula in the same order as the key fields.
  • krikikriki Member, Moderator Posts: 9,112
    DenSter wrote:
    Also you need to put the fields in your calcformula in the same order as the key fields.
    I don't think that is true. In the manual it is written any order.
    And I also noticed that Navision does not always use the same index to calculate the flowfield. It depends which filters are used.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Put the flowfield on a form and drill down. Then you can see the filter and maybe see what is wrong.
  • DenSterDenSter Member Posts: 8,307
    Well it's a different thing to index by Date and then by Store, than to index by store and then by date. Maybe technically you will find the correct values, but for sure you understand that it's not properly done to set filters in different orders.

    The issue is probably not setting the filter in the first place, or not calculating the values, but I wanted to point out that it is just better programming to set the filters in the same order as the key fields. If anything, it makes for easier code maintenance.
Sign In or Register to comment.