1
0
-1

Hi,

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?

 

Thanks

Mark

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hey Mark, 

      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
      import com.avoka.fc.core.entity.Submission
      import com.avoka.fc.core.dao.SubmissionDao
      import com.avoka.fc.core.dao.DaoFactory
      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.

       

      1. Mark Murray

        Hi Ben,

        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?

         

        Thanks

      2. Ben Warner

        Have you tried submission.getTimeLastUserActivity()

      3. Mark Murray

        Thanks Ben, that did the trick.

      4. Mark Murray

        Hi Ben,

        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?

         

        Thanks

      5. Ben Warner

        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

      6. Mark Murray

        Hi Ben,

        thanks for the feedback and initiating the feature request.

        Regards

        Mark

      CommentAdd your comment...