Skip to content

Instantly share code, notes, and snippets.

@zindel
Created August 3, 2016 08:11
Show Gist options
  • Save zindel/343cf2816093d46832178cea665e50b1 to your computer and use it in GitHub Desktop.
Save zindel/343cf2816093d46832178cea665e50b1 to your computer and use it in GitHub Desktop.
edit-enrollment-single-group-no-custom-date:
entity: study_enrollment
type: edit
title: Edit
input:
- study_enrollment: study_enrollment[single-group-no-custom-date]
fields:
- value_key: study_title
label: Study
type: calculation
expression: study_version.__title__
- value_key: enrollment_date
label: Enrollment Date
- enrollment_status
- value_key: visit_todo
label: Visits / Todos
type: todo_visit_status_update
read_only: false
submit_button: Update
query: |
/do(
$_id := update(top(study_enrollment.filter(id()=$study_enrollment)){
id(),
enrollment_date := $enrollment_date,
enrollment_status := $enrollment_status
}),
with($visit_todo, do(
for($v := $visit, with($v, update(top(visit.filter(id()=$id)){
id(),
status := $status
}))),
for($t := $todo, with($t, update(top(todo.filter(id()=$id)){
id(),
status := $status
}))),
)),
for($v := /visit.filter(study_enrollment.id()=$study_enrollment &
status='scheduled').id(),
create_todo($v)),
{id := $_id}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment