Dispatch: Tables And Repeating Sections From An SQL Source

Normalized Source Data


Beginning in version 1.9.5 Sync & Save can populate fields in repeating sections and tables from a normalized SQL data.



  • Enter multiple SQL statements in the Query SQL field.
  • The first query listed must return one record for each Dispatch to be created and must contain a unique key.
  • After the first query, all additional queries can return one or more records that can be used to populate fields in repeating sections or tables. All queries must include the same key included in the first base query.
  • Check the Normalized Source Data option. If this option is not checked only the first query entered will be evaluated.
  • Enter the name(s) of the Key Field(s) that make up the unique key of the first query. If more than one field make up a composite key, separate the field names with a semicolon.



  • Click Refresh on the Source to load example data. If only values from the first query are displayed, make sure the key field configuration is correct on the Settings tab.
  • Click Populate Fields to load the fields available in the form. Note that repeating fields are marked with an asterisk.
  • Note that Sync & Save automatically assigns table names (Table, Table1, etc.) in order to structure the incoming data.
  • Map fields as usual. Note that the full path of the field is included.
  • Click Preview on the Source to preview the data that will be sent to doForms.

When the job is run, two records are dispatched. The second corresponds to the source record displayed above.




Denormalized Source Data


Denormalized source data is in the format of a single line or record in a single table for each required Dispatch.

To use denormalized source data, make sure the Normalized Source Data option is not selected.

When using denormalized source data, the fields in Tables and Repeating Sections are identified by their index number, just as displayed on the View Data tab of the portal:






See the following for an example of how to denormalize data coming from SQL Server that is normalized (present in multiple tables):
  • Given the following tables:
Order


OrderDetail


  • We get the row number for each detail line in the OrderDetail table using the ROW_NUMBER function:
SELECT ROW_NUMBER() OVER (PARTITION BY OrderID ORDER BY OrderDetailID) AS RowNumber, OrderDetailID, ItemCode, Quantity
FROM OrderDetail



  • We can then flatten these records using GROUP BY and CASE:
SELECT  OrderID,
        MIN(CASE RowNumber WHEN 1 THEN ItemCode END) AS ItemCode1,
        MIN(CASE RowNumber WHEN 2 THEN ItemCode END) AS ItemCode2,
        MIN(CASE RowNumber WHEN 3 THEN ItemCode END) AS ItemCode3,
        MIN(CASE RowNumber WHEN 1 THEN Quantity END) AS Quantity1,
        MIN(CASE RowNumber WHEN 2 THEN Quantity END) AS Quantity2,
        MIN(CASE RowNumber WHEN 3 THEN Quantity END) AS Quantity3
FROM         (SELECT ROW_NUMBER() OVER (PARTITION BY OrderID ORDER BY OrderDetailID) AS RowNumber, OrderDetailID, OrderID, ItemCode, Quantity
                FROM OrderDetail) OD
GROUP BY OrderID


  • This query can then be joined to the Order table to produce the final query:
SELECT     [Order].OrderID, [Order].OrderDescription, Detail.ItemCode1, Detail.ItemCode2, Detail.ItemCode3, Detail.Quantity1, Detail.Quantity2, Detail.Quantity3
FROM         [Order] INNER JOIN
                          (SELECT  OrderID,
        MIN(CASE RowNumber WHEN 1 THEN ItemCode END) AS ItemCode1,
        MIN(CASE RowNumber WHEN 2 THEN ItemCode END) AS ItemCode2,
        MIN(Case RowNumber WHEN 3 THEN ItemCode END) AS ItemCode3,
        MIN(CASE RowNumber WHEN 1 THEN Quantity END) AS Quantity1,
        MIN(CASE RowNumber WHEN 2 THEN Quantity END) AS Quantity2,
        MIN(CASE RowNumber WHEN 3 THEN Quantity END) AS Quantity3
FROM         (SELECT ROW_NUMBER() OVER (PARTITION BY OrderID ORDER BY OrderDetailID) AS RowNumber, OrderDetailID, OrderID, ItemCode, Quantity
                FROM OrderDetail) OD
GROUP BY OrderID   ) AS Detail ON [Order].OrderID = Detail.OrderID



  • The Sync & Save Job Format can then be configured:


  • The resulting Dispatch records:



Walkthrough

  1. Introduction
  2. System Requirements
  3. Main Screen
  4. Submissions: Adding A New Job
  5. Submissions: Configuring the Export Settings
  6. Submissions: Setting Up the Export Format
  7. Submissions: Using The Submissions Tab
  8. Submissions: Dealing With Errors
  9. Submissions: Handling Repeating Data
  10. Submissions: Exporting To Text Files
  11. Submissions: Exporting To Sql Server, MySQL, Oracle, Access, Sybase ASE, or ODBC
  12. Submissions: Exporting To Excel
  13. Submissions: Exporting To PowerPivot For Excel
  14. Submissions: Exporting to Word
  15. Submissions: Exporting To QuickBooks
  16. Submissions: Exporting To QuickBooks Customer
  17. Submissions: Exporting To QuickBooks Estimate, Sales Order, Invoice, Sales Receipt
  18. Submissions: Exporting To QuickBooks Vendor
  19. Submissions: Exporting To QuickBooks Purchase Order
  20. Submissions: Exporting To QuickBooks Item Receipt
  21. Submissions: Exporting To QuickBooks Bill
  22. Submissions: Exporting to QuickBooks Receive Payment
  23. Submissions: Exporting To QuickBooks Time Entry
  24. Submissions: Exporting To QuickBooks Online
  25. Submissions: Exporting To QuickBooks Online Customer
  26. Submissions: Exporting To QuickBooks Online Estimate, Invoice, Sales Receipt
  27. Submissions: Exporting To QuickBooks Online Vendor
  28. Submissions: Exporting To QuickBooks Online Purchase Order
  29. Submissions: Exporting To QuickBooks Online Bill
  30. Submissions: Exporting to QuickBooks Online Time Activity
  31. Submissions: Exporting To Sage 50 (Peachtree)
  32. Submissions: Exporting To Sage 50 Quote, Sales Order, Sales Invoice
  33. Submissions: Exporting To Sage 50 Customer
  34. Submissions: Exporting To Sage 100 (MAS 90 / MAS200)
  35. Submissions: Exporting To Sage 100 Sales Order, SO Invoice, AR Invoice
  36. Submissions: Exporting To SharePoint
  37. Submissions: Exporting To Salesforce.com
  38. Submissions: Exporting To Evernote
  39. Submissions: Exporting Attachments
  40. Submissions: Exporting PDF Report
  41. Submissions: Exporting A Specific Date Range
  42. Submissions: Filtering Submissions
  43. Submissions: Archive
  44. Submissions: Approve Before Exporting
  45. Submissions: Working With Date And Time Values
  46. Submissions: Working With Select One and Select Multiple fields
  47. Submissions: System Fields
  48. Submissions: Handling New Versions Of A Form
  49. Submissions: Networkfleet
  50. Submissions: Fleetmatics
  51. Lookup Table: Adding A New Job
  52. Lookup Table: Settings
  53. Lookup Table: From A Sql Source
  54. Lookup Table: From A File Source
  55. Lookup Table: From QuickBooks
  56. Lookup Table: From QuickBooks Online
  57. Lookup Table: From Sage 50
  58. Lookup Table: From SalesForce.com
  59. Lookup Table: From A SharePoint List
  60. Lookup Table: From NetworkFleet
  61. Lookup Table: From Fleetmatics
  62. Lookup Table: Filtering Records
  63. Dispatch: Adding A New Job
  64. Dispatch: Settings
  65. Dispatch: Format
  66. Dispatch: From An SQL Source
  67. Dispatch: From QuickBooks
  68. Dispatch: Tables And Repeating Sections From An SQL Source
  69. Dispatch: From A File Source
  70. Dispatch: Tables And Repeating Sections From An XML Source
  71. Dispatch: From Salesforce.com
  72. GPS: Adding A New Job
  73. GPS: Configuration
  74. Options: Calculations
  75. Options: Encryption
  76. Options: Proxy Server
  77. Options: Email Notifications
  78. Connecting to Sharepoint.com
  79. Connecting to Sharepoint
  80. Connecting To Cloud File Systems
  81. Connecting To SFTP
  82. Connecting To QuickBooks
  83. Connecting To QuickBooks: User Account
  84. Calculating tax on a form for QuickBooks
  85. Scheduling Jobs
  86. Job Log
  87. Run Jobs From An External Application
  88. Sending Information To Support
  89. Sending Job Configuration to Support
  90. Licensing
  91. Upgrading
  92. Backing Up And Restoring
  93. Webservice Quota
  94. Release Notes
  95. Release Notes 1.15.x
  96. Release Notes 1.14.x
  97. Release Notes 1.13.x
  98. Release Notes 1.12.x
  99. Release Notes 1.11.x
  100. Third Party Software

Feedback and Knowledge Base