Hey everyone,
I'm trying to understand how to efficiently use FlowFields. Right now I'm building various reports that pull from the Customer table. Within the Customer table I have created a few FlowFields but performance seems to be an issue. For example one of the FlowFields has the calcformula:
Min("Sales Line Archive"."Order Date" WHERE (Sell-to Customer No.=FIELD(No.),Line Discount %=FILTER(100),Description=FILTER(*Arch)))
I know this isn't the best way to pull the first date of a specific type of free order. Could anyone suggest a better way of pulling the same information?
Also, what Keys/SumIndexFields need to be set with a FlowField such as this?
Thanks for all your help! P.s I've been searching the forum for a while for a question similar to this but with no luck. If I'm reposting a similar question, let me know!
Comments
The number one way to instantly improve performance using filters in an SQL environment is to avoid wildcards and <> statements. And in code, anytime you can use SETRANGE instead of SETFILTER, your results will be (generally) better. Of course these are blanket statements and there are always exceptions.
Regarding Sum Index Fields (SIFT) and their Indexes, these are only used to keep track of numeric totals at each complete index value. Simply put, Navision can derive totals very quickly between differing index values as opposed to traversing the actual table data, one record at a time. It is very impressive technology and implemented brilliantly in the very latest versions of Navision. You must include each field used in the SIFT filter(s) in the SIFT index. In other words, you are only allowed to filter fields that are part of the SIFT index. If you try to filter using a field that is not part of the SIFT index, Navision will give an error and will not allow any further progression. Also, you can not use wildcards in SIFT filters...only ranges. Navision documentation states that the order of fields in the SIFT index does not matter but this is not really true. I try to arrange my SIFT indexes in a top down manner so the most general index that I would ever total by (like general business posting group) is at the beginning and the most specific is at the end (like posting date). Performance is never an issue and my G/L entry table has over 22 million entries spanning many years.
I'll finish this post by stating that I am only a heavy user and developer of SQL-based Navision applications and the above comments are based on my observations of working with databases that are over 50GB in size. I'm sure that more seasoned professionals can give better direction and insight. You can learn tons from this forum and I wish you luck.