Display answers from prevous forms

Hello! I was wondering if there is a way to display multiple previous answers in a form. I am able to display the answer from the most recent form but I want to be able to display all previous answers.

For context: We are using a blood pressure screening form. We are checking the patient's blood pressure on a monthly basis so I want to be able to show the last 6 months worth of blood pressures in the form.

Hi Ashley,

There are a few ways to build something like this in CommCare, depending on your specific use case.

If you need a fairly limited historical record, the easiest thing to do is build a sliding window of data points within the patient case directly. Having a "previous_1, previous_2" set of fields which shift by one in each form (IE: previous_2 = current_case.previous_1) and then displaying them inline.

That obviously has limitations on cases which are shared and might have concurrent updates, or if you need more dense data. For clinical flows like that sometimes it's worth the effort to create separate case records for individual visits which are linked to the patient case. You can then make queries in CommCare's case database within the form to retrieve a set of records and pull out individual fields. That design requires a lot more upfront design for data management, though, like determining how to archive those records to maintain a window, so it's not generally the best first design if more straightforward patterns can solve the need.