I have a number of saved forms that I would like to collect data from; such as trackingCode, firstname, lastname, dob, and so on.
I am trying to create a Groovy script rather than have to interrogate the forms manually (about 150 forms in total).
In pseudo code I am trying to do the following:
get list of saved forms where form code == 'xxx'
list.each print trackingCode, firstname, lastname, etc
export output to csv file
I expect I need SubmissionDao. Is there other options to get such data?
As you are on a pre-fluent version of TM you will need to create a legacy groovy service for this.
The following code should give you the list of submissions you are after and then it is just a matter of pulling the data you need from the submissions and outputting.
import com.avoka.core.groovy.GroovyLogger as logger
String filter = Submission.FORM_CODE_PROPERTY + " = \"xxx\" and " + Submission.FORM_STATUS_PROPERTY + " = \"Saved\""
List<Submission> submissionList = DaoFactory.getSubmissionDao().getAllSubmissionsByFilter(filter, null, null)
logger.debug submissionList.size() + " records found."
You may find it more convenient to actually write this code in the Unit Test tab so you can quickly run it and log the data for copy / paste access.
thanks for the code example.
While I was searching I found SubmissionDao.getSavedSubmissionList which seems to work.
The saved submissions don't have a 'saved date' in the submissionXml. How can I get the saved date for these submissions?
Have you tried submission.getTimeLastUserActivity()
Thanks Ben, that did the trick.
we now have TM v5.0 in our PROD environment. Hooray!
So, I was thinking about updating this to use Fluent SDK based service, instead of the legacy code. I am also looking at automating some data extract collection.
From the TM manager console via Operations > Form Submission Data I can manually 'extract to Excel', but I was wondering whether I can automate that using a groovy service. If that is possible I'll also set up a scheduled service to run daily.
If I use a service, do I need to build my own csv file, or can I collect the form data extracts as some sort of collection that is suitable for export?
Depending on the best approach, what is the best Fluent service to use that is equivalent to the above legacy code?
I don't believe this is possible in the Fluent SDK but I've created a feature request for you as it makes sense to have this capability.
Avoka internal feature ref #TPD-5194
thanks for the feedback and initiating the feature request.