# Data retrieval in opereffa **Category:** [Technical (archive)](https://discourse.openehr.org/c/technical-archive/156) **Created:** 2010-12-23 10:31 UTC **Views:** 1 **Replies:** 1 **URL:** https://discourse.openehr.org/t/data-retrieval-in-opereffa/15846 --- ## Post #1 by @Paria_Kashfi Hello there, Is data retrieval implemented in opereffa? For instance, is it possible to pass a patient name(contextId) to the framework to get all archetype data available for that patient? In the simple example provided by oepreffa, by passing **contextId** and **sessionId,** data is retrieved ``` ArrayList archetypeDatas = new ArrayList(testInstance.getArchetypeDataList(sessionId, contextId)); ``` But the point is that this **sessionId** is not part of patient data. A real scenario will be that the application is running in GUI patient ID or name is specified ( used as the contextId) and then data is retrieved based on that id, and presented on the GUI. Am I right or somehow confused ?! How does an opereffa based application deal with this scenario? Best Regards Pariya MSc; PhD Candidate Department of Computing Science and Engineering Chalmers University of Technology [http://www.ait.gu.se/kontaktaoss/personal/hajar-kashfi/](http://www.ait.gu.se/kontaktaoss/personal/hajar-kashfi/) --- ## Post #2 by @Seref Hi Pariya, The sessionId is the identifier for an instance of an archetype based form. Follow the steps you've given: you have a patientId(contextId) at hand. When you say "then data is retreived based on that id", you need to think about the implementation of this requirement. How would you retrieve data? Normally, you'd expect get back a set of records, each record corresponding to a saved form. What the demo app does is: it gets the last 20 or so (forgot the exact number, check out the source for that) saved form ids (sessionId) and lists them on the UI, on the right hand side. Then you can retrieve details of a particular record/saved form using the sessionId and patient Id. Session id may not be the best name for it, but it has its roots in some issues I've faced trying to use JSF. You need some identifier to retrieve a particular record of a patient, and sessionId is that identifier. Kind regards Seref --- **Canonical:** https://discourse.openehr.org/t/data-retrieval-in-opereffa/15846 **Original content:** https://discourse.openehr.org/t/data-retrieval-in-opereffa/15846