Hi Radzen,
Here is the scenario: a patient of a clinic is assigned a routine, a routine is a specific exercise done at a specific level, where levels depend on the exercise. This is illustrated by the schema below:
https://www.screencast.com/t/DG8lqjk1lsUO
So, when a user edits a routine and changes the exercise, I want to automatically reset the level to one of the levels of the new exercise.
Below is the code of my formChange event:
form0Change(event: any) {
if (event.property == 'ExerciseID') {
this.pbData.getLevels(ExerciseID eq ${event.value}
, null, null, Sequence,Name
, null, null)
.subscribe((result: any) => {
this.notificationService.notify({ severity: "info", summary: Before
, detail: routine.LevelID = ${this.routine.LevelID}
});
this.levels = result.value;
this.level = this.levels[0];
this.routine.LevelID = this.level.LevelID;
this.notificationService.notify({ severity: "info", summary: `After`, detail: `routine.LevelID = ${this.routine.LevelID}` });
}, (result: any) => {
});
}
}
I added 2 notifications (before and after) to make sure routine.LevelID was being set to the correct value. Yet, when I save the record routine keeps its old LevelID as illustrated below:
https://www.screencast.com/t/g7vF6hluMw
(the Level displayed in the grid is correct, this is not a refresh issue of the grid)
This should work... What am I doing wrong?
Thanks