{"id":4685,"date":"2017-03-21T20:23:32","date_gmt":"2017-03-21T20:23:32","guid":{"rendered":"https:\/\/alt2.minisoft.com\/support\/?p=4685"},"modified":"2020-06-30T14:29:40","modified_gmt":"2020-06-30T21:29:40","slug":"loading-multiple-rows-with-sql-load","status":"publish","type":"post","link":"https:\/\/c002.minisoft.com\/support\/loading-multiple-rows-with-sql-load\/","title":{"rendered":"Loading multiple rows with SQL Load"},"content":{"rendered":"<p>SQL Load is an eFORMz procedure to load one or more rows of data from one or more columns of a relational database. Use the eFORMz function\u00a0<a href=\"\/support\/index.php\/eformz-table-lookup\/\">Table Lookup<\/a> to load a single value from a row of a table. Table Lookup is simpler and more efficient for single-value queries.<\/p>\n<p>Complete the following steps to set up an SQL Load procedure. This example lists the invoice date, invoice amount, and invoice status for one customer. You must have a variable set to the number identifying the customer. That value typically comes from a data file.<\/p>\n<ol>\n<li>Open your project in the eFORMz Composer.<\/li>\n<li>Create a <a href=\"\/support\/index.php\/where-to-set-up-your-database-connection\/\">database connection.<\/a><\/li>\n<li>This example sets a variable, CustNum, to 12345. This is the customer number whose invoices we want to list.<\/li>\n<li>Create a variable for each column you want to include in the result set: InvDate, InvAmt, InvState. To create a variable, right click Variable in the Project window &gt; Add variable &gt; By position. Name the variable, and click OK.<\/li>\n<li>Right click the form &gt; Add Pre-condition Procedure &gt; SQL Load. If you have a condition on the form, use Add Post-condition Procedure instead. A post-condition procedure has additional performance costs, so avoid it when possible.<\/li>\n<li>Name the procedure. In the Use variable field select N\/A. Click OK.<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-4686 aligncenter\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad1-300x174.jpg\" alt=\"\" width=\"300\" height=\"174\" srcset=\"https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad1-300x174.jpg 300w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad1-150x87.jpg 150w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad1-250x145.jpg 250w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad1-310x180.jpg 310w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad1.jpg 369w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/li>\n<li>In the SQL Load window, select which database connection to use.<\/li>\n<li>In Parameters, click Add. Select the variable that contains the customer number.<img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-4755 aligncenter\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad2-300x115.jpg\" alt=\"\" width=\"300\" height=\"115\" srcset=\"https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad2-300x115.jpg 300w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad2-150x57.jpg 150w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad2-250x96.jpg 250w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad2.jpg 337w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/li>\n<li>Type your SQL statement into the SQL statement area. Type a question mark (?) where the customer number goes. If you have multiple parameters, they are evaluated in the order they are listed in the Parameters area. \u00a0For example, the following query requires the first parameter in Parameters to be the customer number, and the second to be the region:<br \/>\n<blockquote><p>select InvDate, InvAmt, InvState from invoices where CustNum = ? and Region = ?<\/p><\/blockquote>\n<\/li>\n<li>Click Add in the Columns area. Add the variables that you created in Step 4 in the order that your query returns them.<img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-4757 size-wcslider\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad3-419x500.jpg\" alt=\"\" width=\"419\" height=\"500\" \/><\/li>\n<li>Click OK.<\/li>\n<li>If your database connection is active, the query returns the result set as an array:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-4759 aligncenter\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad4-188x300.jpg\" alt=\"\" width=\"188\" height=\"300\" srcset=\"https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad4-188x300.jpg 188w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad4-94x150.jpg 94w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad4-113x180.jpg 113w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2017\/03\/SQLLoad4.jpg 221w\" sizes=\"(max-width: 188px) 100vw, 188px\" \/><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>SQL Load is an eFORMz procedure to load one or more rows of data from one or more columns of a relational database. Use the eFORMz function\u00a0Table Lookup to load a single value from a row of a table. Table Lookup is simpler and more efficient for single-value queries. Complete the following steps to set [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[84,338],"_links":{"self":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/4685"}],"collection":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/comments?post=4685"}],"version-history":[{"count":6,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/4685\/revisions"}],"predecessor-version":[{"id":8130,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/4685\/revisions\/8130"}],"wp:attachment":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/media?parent=4685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/categories?post=4685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/tags?post=4685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}