Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement configurable default values for functions #4

Open
cwbit opened this issue Apr 21, 2014 · 1 comment
Open

Implement configurable default values for functions #4

cwbit opened this issue Apr 21, 2014 · 1 comment
Assignees

Comments

@cwbit
Copy link
Owner

cwbit commented Apr 21, 2014

Issue #1 brought up the issue where an aggregate field might not have a value if no child records exist (e.g. you just deleted the last child record).

The temporary solution to this was to set the aggregate field value to ZERO if no records came back for the aggregate function.

A better solution would be to implement configurable defaults for each aggregate function instead of forcing ZERO if no values come back.

Imagine I was trying to track the AVG of something - I would rather have it come back as NULL if no records exist than to set it as 0 which might imply records exist but just happen to average out to 0 (which might not always be the case).

@cwbit cwbit self-assigned this Apr 21, 2014
@Indemnity83
Copy link
Contributor

Couldn't you just cache the count along side your avg and check that count > 0 in code to handle the edge case of zero child records?

Seems like this may not be a bug/enhancement necessary in code, just a documentation clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants