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

clarify when odk-instance-first-load is fired #250

Open
MartijnR opened this issue Oct 25, 2019 · 2 comments
Open

clarify when odk-instance-first-load is fired #250

MartijnR opened this issue Oct 25, 2019 · 2 comments

Comments

@MartijnR
Copy link
Contributor

Not immediately clear to me if this done after calculations or before (but may be overlooking).

@lognaturel
Copy link
Member

Yes, that needs to be documented. It should be before. odk-new-repeat also behaves this way and this is explicitly documented. That makes sense, right? You want to base your initial computations on any default values that have been set, for example.

The current description is just "dispatched the first time an instance is loaded" which is actually pretty confusing because it sounds like it refers to primary vs secondary instances to me. Maybe "the first time that the primary instance for a specific record is loaded, before initial evaluation of calculates, constraints, etc"?

@MartijnR
Copy link
Contributor Author

Thanks!

Yes, that would be consistent with odk-new-repeat, and that's what I assumed Collect is doing, and seems fine to me.

I think there are always use cases that have a problem with whatever we choose. The current one of a client is to 'calculate' a value from an external instance (e.g. with pulldata) and use that stored value in the dynamic default (and elsewhere in other calculations) But the solution to that problem is simple, they will have to put the pulldata part in the default expression directly and perhaps accept some duplication of the pulldata() expression if they plan to use it multiple times.

"the first time that the primary instance for a specific record is loaded, before initial evaluation of calculates, constraints, etc"?

Yes, that's sound good.

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

No branches or pull requests

2 participants