chadski021 Posted October 21, 2014 Posted October 21, 2014 I need to get the total amount of the invoice but when i add summary field it slows down the database. i have alternative but it sometimes slow here is the script. Performfind SetVariable $total::Value:0 Loop Go to first record SetVariable $total::value::$total+amount Go to next record End Loop
Wim Decorte Posted October 21, 2014 Posted October 21, 2014 Assuming that you have a relationship between the invoice and its invoice items then you can set the invoice total fields to the sum() of the invoice items. Don't make that a calculation field but use the scripted approach to set the field. As an aside: if you need to loop through records to pick up data, you can do that without actually going to the record: look into the GetNthRecord() function. 1
comment Posted October 21, 2014 Posted October 21, 2014 IMHO, nothing is faster than a summary field. If you are experiencing performance issues (most likely as a result of displaying too many summary or unstored calculation values at once) and want to move to a scripted method, then take the summary field off your layout/s, but keep it in the table/s. Then set a number field directly to the summary (or sub-summary, as the case may be) value.
Recommended Posts
This topic is 3743 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