Pre-populate with last entry
-
Hi again,
I am having some difficulty pre-populating a field with the ‘last value that the same user entered’. Example: user 1-3 record blood pressure every day, but each day the number in the form is defaulted to the value from yesterday.
I thought I would achieve this by using
1) a Number DS with an sql query:
[select bp from labs where id = (select max(id) from labs where user_id = @user_id)],
and then
2) default the Blood Pressure field to the Number DS.however, I have three problems:
1 – my query resolves, but only without hardcoded ‘1’ or ‘2’ replacing the @user_id part – i do not have the correct syntax to filter on user_id – how could I use the ‘current session user id’ in my SQL query?
2 – my DB connection is good and my query resolves (by testing it in the Form Builder, I get the popup with a result), but I still cannot see the result in the number DS when i preview the whole form. What is going wrong here?
3 – what would the correct code in the Blood Pressure field be, to default it to the Number DS?
Do you agree with the approach? If so i would very much appreciate feedback on the above.
Best Regards,
Lars
- The topic ‘Pre-populate with last entry’ is closed to new replies.