Class TxnQuery
Provides a transaction value object query class.
Examples
Please find the transaction query examples about list, get first and count below.
Transaction Query List Example
This Groovy example shows how to list transactions matching certain criteria ordered descending by id (maximum number of 150 records).
 import com.avoka.tm.query.*
 import com.avoka.tm.vo.*
 List<Txn> txns = new TxnQuery()
      .setFormVersionNumber("2.0")
      .setFetchLimit(150)
      .addOrderByDesc("id")
      .listValues()
 // In JSON format
 String txnsReady = new TxnQuery()
      .setFormVersionNumber("2.0")
      .setDeliveryStatus("Ready")
      .setUserLoginName("[email protected]")
      .setSpaceName("Work Space")
      .listJson() 
 Transaction Query First Example
This Groovy example shows how to get first transaction matching certain criteria ordered descending by id.
 import com.avoka.tm.query.*
 import com.avoka.tm.vo.*
 Txn txn = new TxnQuery()
      .setFormVersionNumber("3.2")
      .addOrderByDesc("id")
      .firstValue()
 // In JSON format
 String txnReady = new TxnQuery()
      .setFormVersionNumber("2.0")
      .setDeliveryStatus(Txn.DELIVERY_READY)
      .firstJson()  
 Transaction Query Count Example
This Groovy example shows how to count all transactions matching certain criteria.
 import com.avoka.tm.query.*
 int readyCount = new TxnQuery()
      .setFormVersionNumber("2.0")
      .setDeliveryStatus(Txn.DELIVERY_READY)
      .count()  
 Transaction Query Job Example
The example below returns the list of transactions associated the job reference number.
 import com.avoka.tm.query.*
 import com.avoka.tm.vo.*
 List<Txn> txns = new TxnQuery()
      .setJobRefNumber("L9MKYT")
      .listValues() 
 The example below returns the list of transactions associated the specified job step.
 import com.avoka.tm.query.*
 import com.avoka.tm.vo.*
 Job job = new JobQuery()
      .setJobRefNumber("L9MKYT")
      .firstValue()
 JobStep jobStep = job.jobSteps.get(1)
 List<Txn> txns = new TxnQuery()
      .setJobStep(jobStep)
      .listValues() 
 Transaction Query "With" Example
For performance reasons TxnQuery does not load all of the Txn properties (formDataMap, formXml, receiptPdf, fileAttachList etc. or all of them) by default. Note the capability of withXYZ() methods for loading necessary transaction attributes.
This Groovy example shows how to query transactions and load their form data map and receipt pdf.
 import com.avoka.tm.query.*
 import com.avoka.tm.vo.*
 Txn txn = new TxnQuery()
      .setFormVersionNumber("2.0")
      .setDeliveryStatus(Txn.DELIVERY_READY)
      .withFormDataMap()
      .withReceiptPdf()
      .firstValue()
 byte[] receiptPdf = txn.receiptPdf 
 This Groovy example shows how to query transactions and load all transaction attributes (fileAttachList, formDataMap, formXml, groupNames, propertyMap, receiptPdf).
 import com.avoka.tm.query.*
 import com.avoka.tm.vo.*
 String txnJson = new TxnQuery()
      .setFormVersionNumber("2.0")
      .setDeliveryStatus(Txn.DELIVERY_READY)
      .withAll()
      .firstJson()
 String formXml = txn.formXml
 byte[] receiptPdf = txn.receiptPdf - Since:
- 5.0.0
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumThe startDate and endDate filter time type.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionAdd the group name to the transaction query so that only transactions belonging to the form group are included.addOrderByAsc(String orderProperty) Add the sort order by ascending to the query.addOrderByDesc(String orderProperty) Add the sort order by descending to the query.intcount()Execute a select count query and return the total number of records selected by the query.Execute the query and return the first transaction JSON value.Execute the query and return the first transaction value object for the query.hasDataExtract(String name) Set data extract name parameter.hasDataExtractNameValue(String name, String value) Set data extract name/value parameter.hasDataExtractValue(String value) Set data extract name parameter.hasNoProperty(String name) Set has none of the property names in this query filter parameter.hasProperty(String name) Set property name parameter.hasPropertyNameValue(String name, String value) Set property name/value parameter.hasPropertyValue(String value) Set property value parameter.listJson()Execute the query and return an transactions JSON array list.Execute the transaction query and return a list of Txn value objects.setAttachmentsStatus(String attachmentsStatus) Set the transaction attachment status query parameter [ Required | Optional | Completed ].setDeliveryStatus(String deliveryStatus) Set the transaction delivery status query parameter [ Not Ready | Ready | Sent_Email | In Progress | Pending | Completed | Error | Undeliverable | Not Required ].setEmailAddress(String emailAddress) Set the contact email address query parameters.setEndDate(Date date) Set the transaction end date filter (defaults to request time).setFetchLimit(int fetchLimit) Set the query fetch limit to limit the maximum number of records returned.setFormCode(String formCode) Set the form code query parameter.setFormStatus(String formStatus) Set the transaction form status query parameter [ Assigned | Opened | Saved | Submitted | Completed | Expired | Abandoned ].setFormVersionNumber(String formVersionNumber) Set the form version number query parameter.Set the transaction id (PK) query parameter.setJobRefNumber(String jobRefNumber) Set the job reference number query parameter.setJobStep(JobStep jobStep) Set the job step query parameter.setLinkedTxnId(Number linkedTxnId) Set the transaction linkedTxnId query parameter.setMilestone(String milestone) Set the transaction milestone query parameter.setPaymentStatus(String paymentStatus) Set the transaction payment status query parameter [ Required | Completed | Error | Pending ].setReceiptNumber(String receiptNumber) Set the transaction receipt number query parameter.setSpaceName(String spaceName) Set the form space name query parameter.setStartDate(Date date) Set the transaction time start date filter (defaults to request time).setSubmitKey(String submitKey) Set the transaction submission key (GUID) query parameter.setTaskClaimed(Boolean taskClaimed) Set whether to filter for claimable tasks which have been either claimed or not claimed.setTime(TxnQuery.Time time) setTrackingCode(String trackingCode) Set the transaction tracking code query parameter.Set the transaction query parameter.setTxnReferenceNumber(String txnReferenceNumber) Set the transaction reference number query parameter.setUserLoginName(String userLoginName) Set the transaction user's login name (username).setUserSaved(boolean userSaved) Set the user saved query parameter.withAll()Set the query to return the transaction with all the associated attachments map, form data map, form XML, group names, property map and receipt PDF data.Set the query to return the transaction with the associated transaction workspaces comments.Set the query to return the transaction with the associated transaction delivery functions.Set the query to return the transaction with the associated file attachment list.Set the query to return the transaction with the associated form data map information.Set the query to return the transaction with the associated form XML information.Set the query to return the transaction with the associated group names information.Set the query to return the transaction with the associated property map information.Set the query to return the transaction with the associated receipt PDF data.
- 
Constructor Details- 
TxnQuery
 
- 
- 
Method Details- 
setAttachmentsStatusSet the transaction attachment status query parameter [ Required | Optional | Completed ].- Parameters:
- attachmentsStatus- the attachments status
- Returns:
- the transaction query
 
- 
setEmailAddressSet the contact email address query parameters.- Parameters:
- emailAddress- the contact address query parameter
- Returns:
- the transaction query
 
- 
setDeliveryStatusSet the transaction delivery status query parameter [ Not Ready | Ready | Sent_Email | In Progress | Pending | Completed | Error | Undeliverable | Not Required ].- Parameters:
- deliveryStatus- the delivery status query parameter
- Returns:
- the transaction query
 
- 
setFormCodeSet the form code query parameter.- Parameters:
- formCode- the form code query parameter
- Returns:
- the transaction query
 
- 
setFormStatusSet the transaction form status query parameter [ Assigned | Opened | Saved | Submitted | Completed | Expired | Abandoned ].- Parameters:
- formStatus- the form status query parameter
- Returns:
- the transaction query
 
- 
addGroupAdd the group name to the transaction query so that only transactions belonging to the form group are included. Filtering on multiple groups is supported.- Parameters:
- groupName- the group name to query parameter
- Returns:
- the transaction query
- Since:
- 17.10.0
 
- 
setIdSet the transaction id (PK) query parameter.- Parameters:
- id- the transaction id (PK) query parameter
- Returns:
- the transaction query
 
- 
setLinkedTxnIdSet the transaction linkedTxnId query parameter.- Parameters:
- linkedTxnId- the transaction linkedTxnId query parameter
- Returns:
- the transaction query
- Since:
- 21.11
 
- 
setTxnSet the transaction query parameter.- Parameters:
- txn- the transaction query parameter (required)
- Returns:
- the transaction query
 
- 
setJobStepSet the job step query parameter.- Parameters:
- jobStep- the job step query parameter
- Returns:
- the transaction query
 
- 
setJobRefNumberSet the job reference number query parameter.- Parameters:
- jobRefNumber- the job reference number query parameter
- Returns:
- the transaction query
 
- 
setUserLoginNameSet the transaction user's login name (username).- Parameters:
- userLoginName- the transaction user's login name (username).
- Returns:
- the transaction query
 
- 
setPaymentStatusSet the transaction payment status query parameter [ Required | Completed | Error | Pending ].- Parameters:
- paymentStatus- the transaction payment status query parameter
- Returns:
- the transaction query
 
- 
setReceiptNumberSet the transaction receipt number query parameter.- Parameters:
- receiptNumber- the transaction receipt number query parameter
- Returns:
- the transaction query
 
- 
setSubmitKeySet the transaction submission key (GUID) query parameter.- Parameters:
- submitKey- the transaction submission key (GUID) query parameter
- Returns:
- the transaction query
 
- 
setTrackingCodeSet the transaction tracking code query parameter.- Parameters:
- trackingCode- the transaction tracking code query parameter
- Returns:
- the transaction query
 
- 
setTxnReferenceNumberSet the transaction reference number query parameter.- Parameters:
- txnReferenceNumber- the transaction reference number query parameter
- Returns:
- the transaction query
 
- 
setFormVersionNumberSet the form version number query parameter.- Parameters:
- formVersionNumber- the form version number query parameter
- Returns:
- the transaction query
 
- 
setSpaceNameSet the form space name query parameter.- Parameters:
- spaceName- the form space name query parameter
- Returns:
- the transaction query
 
- 
setUserSavedSet the user saved query parameter.- Parameters:
- userSaved- the the user saved query parameter
- Returns:
- the transaction query
- Since:
- 5.1.3
 
- 
setMilestoneSet the transaction milestone query parameter.- Parameters:
- milestone- the transaction milestone
- Returns:
- the transaction query
- Since:
- 17.10.0
 
- 
setTaskClaimedSet whether to filter for claimable tasks which have been either claimed or not claimed. Applying this filter will exclude any transactions which are not claimable. Please note claimable transactions are for authenticated users only, and not for anonymous (email) tasks.- Parameters:
- taskClaimed- the task claimed status
- Returns:
- the transaction query
- Since:
- 18.11.0
 
- 
hasPropertySet property name parameter.- Parameters:
- name- the property name query parameter
- Returns:
- the transaction query
- Since:
- 5.0.1
 
- 
hasPropertyValueSet property value parameter.- Parameters:
- value- the property value query parameter
- Returns:
- the transaction query
- Since:
- 5.0.1
 
- 
hasPropertyNameValueSet property name/value parameter.- Parameters:
- name- the property name query parameter
- value- the property value query parameter
- Returns:
- the transaction query
- Since:
- 19.05
 
- 
hasDataExtractSet data extract name parameter.- Parameters:
- name- the data extract name query parameter
- Returns:
- the transaction query
- Since:
- 19.05
 
- 
hasDataExtractValueSet data extract name parameter.- Parameters:
- value- the data extract value query parameter
- Returns:
- the transaction query
- Since:
- 19.05
 
- 
hasDataExtractNameValueSet data extract name/value parameter.- Parameters:
- name- the data extract name query parameter
- value- the data extract value query parameter
- Returns:
- the transaction query
- Since:
- 19.05
 
- 
hasNoPropertySet has none of the property names in this query filter parameter.- Parameters:
- name- the has not property name query parameter
- Returns:
- the transaction query
- Since:
- 5.1.10
 
- 
setStartDateSet the transaction time start date filter (defaults to request time).- Parameters:
- date- the transaction start date filter (defaults to request time)
- Returns:
- the transaction query
- Since:
- 17.10.0
 
- 
setEndDateSet the transaction end date filter (defaults to request time).- Parameters:
- date- the transaction end date filter (defaults to request time)
- Returns:
- the transaction query
- Since:
- 17.10.0
 
- 
setTime- Parameters:
- time- the time to set (defaults to request time)
- Returns:
- the transaction query
- Since:
- 17.10.0
 
- 
setFetchLimitSet the query fetch limit to limit the maximum number of records returned. The default query fetch limit is 100 records. The maximum fetch limit is 10,000 records.- Parameters:
- fetchLimit- the query fetch limit
- Returns:
- the transaction query
 
- 
withAll@FluentSecurityPermission(permissions={"submission-data-view","submission-xml-data-view"}) public TxnQuery withAll()Set the query to return the transaction with all the associated attachments map, form data map, form XML, group names, property map and receipt PDF data.- Returns:
- the transaction query
 
- 
withFormDataMapSet the query to return the transaction with the associated form data map information.- Returns:
- the transaction query
 
- 
withFormXmlSet the query to return the transaction with the associated form XML information.- Returns:
- the transaction query
 
- 
withGroupNamesSet the query to return the transaction with the associated group names information.- Returns:
- the transaction query
 
- 
withPropertyMapSet the query to return the transaction with the associated property map information.- Returns:
- the transaction query
 
- 
withReceiptPdfSet the query to return the transaction with the associated receipt PDF data.- Returns:
- the transaction query
 
- 
withFileAttachListSet the query to return the transaction with the associated file attachment list.- Returns:
- the transaction query
 
- 
withDeliveryFuncsSet the query to return the transaction with the associated transaction delivery functions.- Returns:
- the transaction query
- Since:
- 17.10.0
 
- 
withCommentsSet the query to return the transaction with the associated transaction workspaces comments.- Returns:
- the transaction query
- Since:
- 19.11.0
 
- 
addOrderByAscAdd the sort order by ascending to the query.- Parameters:
- orderProperty- the property to sort by (required)
- Returns:
- the transaction query
 
- 
addOrderByDescAdd the sort order by descending to the query.- Parameters:
- orderProperty- the property to sort by (required)
- Returns:
- the transaction query
 
- 
countpublic int count()Execute a select count query and return the total number of records selected by the query. Does not support count queries with more than one property.- Returns:
- the total number of records selected by the query
 
- 
listValuesExecute the transaction query and return a list of Txn value objects. Can result in less records returned than defined by the fetch limit.- Returns:
- execute the transaction query and return a list of Txn value objects
 
- 
listJsonExecute the query and return an transactions JSON array list.- Returns:
- execute the query and return an transactions JSON array list
 
- 
firstValueExecute the query and return the first transaction value object for the query.- Returns:
- execute the query and return the first transaction value object for the query
 
- 
firstJsonExecute the query and return the first transaction JSON value.- Returns:
- execute the query and return the first transaction JSON value
 
 
-