0

My question is very straightforward.

I would like to add some functions in my database to return results directly with data entry.

In order to do that, I need to be able to use AVG and SUM SQL functions. Is that possible with the REDCap system?

wibeasley
  • 5,000
  • 3
  • 34
  • 62
  • Can you be more specific? REDCap's database is not accessible to users to run SQL queries, and data is generally exported in one or another format (typically CSV plus some kind of syntax file format for labels and other structures for specific analysis applications). Calculations can be performed within forms, and operations like average are available, but this won't help you across multiple records; only across multiple fields within a single record. – Jangari Jan 24 '19 at 04:35
  • 1
    Thank you so much for responding so quickly. REDCap -at least the latest versions- allow superusers to run SQL queries. I have been running some "SELECT" queries already. However, I am wondering if anyone knows a way to also run avg and sum queries in the REDCap environment. I am suspecting that this is simply not supported. – Chronis Kemos Jan 27 '19 at 16:25
  • Do you mean the "Database Query (SQL)" field type when editing a data collection form in the online designer? This can only be used to populate a drop-down list of results from a field in another different project. For example in one project you could manage a complete list of medications and categorise them by type, and in another project you could have a drop-down list that uses a SQL query to select all medications of a certain type, allowing the user to choose one. – Jangari Jan 28 '19 at 22:45
  • Anyway, the SQL lookup won't give you what you want. If you are a REDCap admin (which you would need to be to have access to SQL query field type) then you can ask the developers on the REDCap Community site. – Jangari Jan 28 '19 at 22:46
  • You are correct. Apparently, the SQL functionality of REDCap is restricted to what you have described already. I have decided to use APIs and run them daily to get what I was looking for instead. Thanks for your help. – Chronis Kemos Feb 08 '19 at 15:00

1 Answers1

2

If you're still wondering this 7 months later, starting with version 11 you can use:

[aggregate-mean:fields:parameters]

and

[aggregate-sum:fields:parameters]
SonOfALink
  • 471
  • 4
  • 10