TaskCentre v4.5 Database Query (OLEDB) Tl White Paper Dcument Number: PD500-03-06-1_0-WP Orbis Sftware Limited 2010
Table f Cntents COPYRIGHT 1 TRADEMARKS 1 INTRODUCTION 2 Overview 2 Features 2 GLOBAL CONFIGURATION 2 OLEDB Cnnectins 2 Prperties dialg 4 TECHNICAL SUMMARY 8 Wrking with ther Steps 8 Dependencies 9 Objects Cnsumed 10 Objects Expsed 10 CONFIGURATION 10 General 10 Query 10 Tlbar 11 OLEDB Schema 13 Design tab 15 SQL tab 19 Request tab 19 Results 20 Optins 21 i
Cpyright & Trademarks Cpyright The cpyright in this dcument is wned by Orbis Sftware 2010. All rights reserved. This publicatin may nt, in whle r part, be reprduced, transmitted, transcribed, stred in a retrieval system r translated int any language in any frm r by any means withut the prir written cnsent f Orbis Sftware Limited. Head Office: Orbis Sftware Limited (UK) 2 Nuffield Rad Nuffield Industrial Estate Ple, Drset BH17 0RB United Kingdm Tel: +44 (0) 1202 241124 Fax: +44 (0) 1202 241125 Email: enquiries@rbis-sftware.cm Trademarks Orbis Sftware Ltd wns the registered Trademark TaskCentre. All ther Trademarks used within this dcumentatin are acknwledged as the prperty f their respective wners. The infrmatin prvided in this publicatin may cntain errrs, missins, r typgraphical errrs r may be ut f date. Orbis Sftware may change, delete, r update any published infrmatin at any time and withut prir ntice. The infrmatin published in this dcument is prvided fr infrmatinal purpses nly and is nt binding n Orbis Sftware in any way except t the extent that it is specifically indicated t be s. 1
Database Query (OLEDB) Tl Intrductin Overview The Database Query (OLEDB) is an Input Tl which is used t create a Task Step that allws the extractin f specific infrmatin sets frm relatinal database systems such as; ERP, Financial, Accunting, MRP, Prductin, CRM, HR, Prject and Bespke systems etc. Once btained by this Step, the infrmatin is then available t ther Frmat r Output Steps fr manipulatin and/r delivery. The Tl has cmprehensive OLEDB supprt fr bth mdern and legacy platfrms supprting bth the SQL 89 and SQL 92 ODBC standards, as well as variatins n these standards. The Tl prvides a highly functinal, visual interface fr building queries using drag & drp techniques, as well as the ability t write cmpletely custm SQL statements, if finite levels f cntrl are required. When using the visual methd, the SQL script is created fr yu and can be viewed fr clarity. Queries can be tested and viewed, with sampling functinality available fr efficient testing f larger queries. Nte that the TaskCentre Database Query (ODBC) Tl has the same functinality as the Database Query (OLEDB) Tl and gives users the ability t use the TaskCentre GUI t prduce SQL queries against legacy systems that currently d nt have the benefit f OLEDB drivers. Features Glbal Cnfiguratin The Database Query (OLEDB) Tl requires n glbal cnfiguratin. Hwever, cnnectins t data surces must first be cnfigured thrugh the OLEDB Cnnectins dialg. OLEDB Cnnectins T use either the Database Query (OLEDB) r the Call Prcedure (OLEDB) Tl t create a Step, cnnectins t data surces must first be cnfigured thrugh the OLEDB Cnnectins dialg. A Cnnectin cntains all the infrmatin necessary t cnnect t a given database (OLEDB Prvider) and nce this is cnfigured the cnnectin can be used by any user wh has permissins. 2
Database Query (OLEDB) Tl Figure 1. OLEDB Cnnectins dialg. The OLEDB Cnnectins dialg (Ref: Figure 1) is displayed by clicking n the Input nde in the Task Manager and then duble-clicking n the Tl icn in the Items List r thrugh the menu system under Manage > Tls > Input > Database Query (OLEDB). It prvides all the functinality fr creating and maintaining cnnectins thrugh the fllwing items: 3
Database Query (OLEDB) Tl Figure 2. Available OLEDB Prviders dialg. Prperties dialg The Prperties dialg cnsists f fur tabbed panes described belw thrugh which all prperties fr the selected cnnectin are displayed fr editing. General Figure 3. Prperties dialg General tab. The General tab (Ref: Figure 3) cntains the fllwing: 4
Database Query (OLEDB) Tl Cnnectin Figure 4. Prperties dialg Cnnectin tab. The Cnnectin tab (Ref: Figure 4) cntains the fllwing: Set Lck Timeut (ptin check bx) - If checked then the ptin is selected and the 'Secnds' cntrl is activated. Secnds (cntrl) - The up and dwn arrws may be used t set the number f secnds. 5
Database Query (OLEDB) Tl Cursrs Figure 5. Prperties dialg Cursrs tab. The Cursr Tab (Ref: Figure 5) cntains the fllwing ptins t specify the type f database cursr t be used when executing stred prcedures. Re-usable (scrllable) (ptin check bx) - This ptin is the default selectin and allws the cursr t mve bth frwards and backwards thrugh the stred prcedure rws, enabling the Call Prcedure (OLEDB) Step t be re-used within a Task. This may be required where the Task cntains mre than ne Frmat and Output Step that need t use the same Call Prcedure (OLEDB) Step. D nt reflect changes in underlying data surce (ptin radi buttn) - The rws returned by a stred prcedure are cached independently at the time the stred prcedure is executed. Therefre, when the infrmatin is actually read, any subsequent changes in the surce data are nt reflected. Reflect rw deletins and changes nly (ptin radi buttn) - Any rw deletins and rw changes made between when the stred prcedure is executed and when the results are read are reflected. Reflect rw deletin, changes and additins (ptin radi buttn) - Any changes made between when the stred prcedure is executed and when the results are read are reflected. Optins 6
Database Query (OLEDB) Tl Figure 6. Prperties dialg Optins tab. The Optins tab (Ref: Figure 6) displays the fllwing default rules fr the OLEDB data surce being used and may be edited as required: SQL-89 Operatr/Symbl Jin expressins are implemented in the WHERE clause and the Outer Jin Symbl is implemented adjacent t the jin Operatr. SQL-89 Identifier/Symbl Jin expressins are implemented in the WHERE clause and the Outer Jin Symbl is implemented adjacent t the jin Identifiers. SQL-92 Standard Jin expressins are implemented in the FROM clause as per the standard SQL 92 specificatin. Serialised - Data read by a current transactin cannt be changed by anther transactin until the current transactin finishes. N new data can be inserted that wuld affect the current transactin. This is the safest islatin level. Repeatable Read - Data read by a current transactin cannt be changed by anther transactin until the current transactin finishes. Any type f new data can be inserted during a transactin. Read Cmmitted - A transactin cannt read data that is being mdified by anther transactin that has nt cmmitted. Read Uncmmitted - A transactin can read any data, even if it is being mdified by anther transactin. This is the least safe islatin level but allws the highest cncurrency. Default Takes the default used n that particular server cnnectin. E.g. MS SQL server default is read cmmitted. 7
Database Query (OLEDB) Tl Technical Summary Wrking with ther Steps The ther Steps that the Database Query (OLEDB) Step will interact directly with, whether by expsing infrmatin t it r cnsuming infrmatin frm it are listed belw. Step Icn Name Step Type Schedule Event Step MS SQL Server Trigger Event Step Oracle Trigger Event Step SMTP Event Step Wrkflw Jb Submissin Event Step Database Query (ODBC) Input Step Call Prcedure (OLEDB) Input Step Step Icn Name Step Type Frmat as Text Frmat Step Frmat as HTML Frmat Step Run Crystal Reprt Frmat Step Merge MS Wrd Dcument Frmat Step Create Wrkflw Jb Frmat Step XML t Recrdset Frmat Step Data Filter General Step Text Parser General Step Decisin General Step Save as File Output Step File Transfer (FTP) Output Step Call Prcedure Output Step 8
Database Query (OLEDB) Tl Call COM Object Execute Step Run Prgram Execute Step Call Prcedure Execute Step Run VB Script Execute Step Dependencies The prducts, technlgies, prtcls r systems that are required fr the Database Query (OLEDB) Step t wrk are listed belw. Imprtant Nte: The UDT (User define data) type available thrugh SQL Server 2008 is NOT currently supprted 9
Database Query (OLEDB) Tl Objects Cnsumed Objects that the Database Query (OLEDB) Step cnsumes that are expsed by ther Steps are listed belw. Objects Expsed Objects that the Database Query (OLEDB) Step expses, that can be utilised by ther Steps are listed belw. Cnfiguratin A Database Query (OLEDB) Step fr a Task is cnfigured thrugh the Database Query (OLEDB) dialg which is displayed thrugh the fllwing methds: T create a new Step: T pen an existing Step: The dialg cntains the fur tabbed panes listed and described belw thrugh which a Database Query (OLEDB) Step may be created and cnfigured. General Figure 7. Database Query (OLEDB) General tab. The cntents f the General tab (Ref: Figure 7) are as fllws: Query 10
Database Query (OLEDB) Tl Figure 8. Database Query (OLEDB) Query tab. The Query tab (Ref: Figure 8) is used t define all the key elements f the Query itself. The items cntained in the tab thrugh which a query may be cnfigured are described belw. Tlbar The Tlbar is lcated at the tp f the dialg and displays a number f icns which prvide shrtcuts t varius functins as detailed in the table belw. Icn Functin Displays the 'Tables & Jins' pane in the Design Tab. Displays the 'Clumns' pane in the Design Tab. Displays the 'Gruping' pane in the Design Tab. Displays the 'Criteria' pane in the Design Tab. Displays the 'Having' pane in the Design Tab. Displays the 'Srting' pane in the Design Tab. Reverts t SQL Free Type Mde by selecting the SQL sub-tab int which yu can enter the script directly. Once selected, this mde must be used t edit the query. Runs the query and displays the results in the Results Tab. This functin is als available when the General and Results tabs are selected and is a great feature fr testing the query. Cancels the executin f the query. Displays the Predicates dialg (Ref: Figure 3) t filter the query results. 11
Database Query (OLEDB) Tl Predicates dialg Figure 9. Predicates dialg. The Predicates dialg (Ref: Figure 9) is displayed when the Predicates icn is selected in the Tlbar and is used t insert a predicate in the SQL statement generated. The dialg supprts the standard SQL predicates but als makes prvisin fr prprietary predicates t be used fr drivers that implement them. The dialg cntains the fllwing: 12
Database Query (OLEDB) Tl OLEDB Schema The left side f the screen cntains the OLEDB Schema pane (Ref: Figure 10) which displays the available data tables, clumns and views in a tree frmat. The data expsed depends n the data surce selected in the Cnnectins drp dwn list in the General tab. Figure 10. OLEDB Schema. Imprtant Nte: The UDT (User define data) type available thrugh SQL Server 2008 is NOT currently supprted. Clumns may be selected and then dragged and drpped int varius panes n the right f the dialg. Fr example, a clumn called NAME cntained in the SALES_ORDER table is dragged int the 'Clumns' pane. The Tables and Jins icn in the Tlbar is then selected t display the Tables & Jins pane which has been autmatically ppulated with the SALES_ORDER table. If a clumn frm anther table was added t the Clumns pane, then its table wuld als be autmatically added int the Tables & Jins pane. In additin t the tables and clumns described abve, the tree als cntains an item called Frmulas which are used t create new Clumns based n thse available. Right-clicking n the fx (Frmulas) item prvides access t the Frmula Editr dialg (Ref: Figure 5) thrugh which a new Frmula may be created. An example f using a Frmula culd be where it is required t display the value f an item in a different currency. A frmula is created t multiply the Unit Price Clumn by an applicable fixed number t cnvert the value. The Frmula is then dragged and drpped int the Clumns pane t be included in the query recrdset. 13
Database Query (OLEDB) Tl Frmula Editr dialg The Frmula Editr dialg (Ref: Figure 11) is used t create a Frmula fr a table jin r Object and is displayed thrugh the methds listed belw. Frmulas can be used t frmat data, create new clumns r fr data type cnversin. The dialg cntains the fllwing: Select Tables dialg Figure 11. Frmula Editr dialg. Figure 12. Select Tables dialg. The Select Tables dialg (Ref: Figure 12) is displayed when the Tables buttn is selected in the Frmula Editr dialg and is used t select and de-select the applicable tables used in the SQL statement. 14
Database Query (OLEDB) Tl This is nly required if the SQL statement has been manually entered. If clumns have been dragged and drpped int the Frmula Editr area frm the ODBC Schema area then the table will have autmatically been added and will be displayed as being selected in the Select Tables dialg. The dialg cntains the fllwing: Clicking n a name and dragging the muse up r dwn the list t highlight the required tables. Clicking n a name, hlding dwn the Shift key n the keybard and clicking n anther name t select the blck f tables between the tw selected. Clicking n individual names whilst hlding dwn the Ctrl key n the keybard. Design tab The Design tab is displayed by default n the right side f the dialg when the Query tab is first selected. It cntains a number f panes described belw which are selectable frm the Tlbar. General Prperties Figure 13. Design tab. A bar at the tp f each pane displays the pane name and has the fllwing prperties: Tables & Jins The Tables & Jins pane displays the tables within the query and the relatinships (jins) between them. OLEDB Direct (N Data Mdel) - If using a direct OLEDB cnnectin (i.e. withut a Data Mdel), the jins must be expsed by the OLEDB Driver fr the jins t be created autmatically. Sme Drivers supprt the expsure f jin infrmatin and sme d nt and with thse that d it will ften still depend n the jins having been defined at the database level. Data Mdel - The jins are prvided by the Data Mdel s prviding the Data Mdel is cmplete, jins will autmatically be created fr knwn table relatinships. Clumns 15
Database Query (OLEDB) Tl The Clumns pane is used t specify the clumns that are returned in the query. The Clumns available are displayed n the left f the dialg in the ODBC Schema r Data Mdel. Frmula Clumns can als be created n the fly t prvide manipulatin f data whether fr frmatting r calculatins. Frmula Clumns Frmula Clumns enable the user t return infrmatin in the Query that is nt available in the database. The feature can be used t transfrm Clumns that exist in the database by perfrming data type cnversins, frmatting r calculatins f almst limitless cmplexity. Gruping The Gruping pane is used t create a query that returns cnslidated data and is cmmnly used in cnjunctin with aggregatin functins such as SUM r COUNT. By selecting certain clumns within the Gruping pane the data is cnslidated s that n duplicates exist acrss the fields returned. In turn, the aggregate functins enable infrmatin such as ttals r averages t be calculated acrss the recrds that are cnslidated. The pane crrespnds directly with the GROUP BY clause in the SQL syntax. Criteria The Criteria pane is used t restrict the rws that are returned by the query. The Criteria defined in this pane are applied befre Gruping, if used. Gruping is the graphic equivalent f enclsing cnditin in parenthesis t impse the rder in which they are applied. Multiple Criteria can be added within the Criteria pane and the criteria can be nested using drag & drp t ensure precedence when using a cmbinatin f AND and OR peratrs. Figure 14. Value dialg. 16
Database Query (OLEDB) Tl Figure 15. Clumn Sample dialg. New nested Criteria grups are created by dragging ne Criteria nt anther. Criteria can be dragged frm ne grup t anther (including the implicit tp level grup) by dragging them int the relevant square bracket area fr that grup. 17
Database Query (OLEDB) Tl Having The Having pane has exactly the same features as the Criteria pane. Clumns are added in the same way and selecting the criteria fr filtering is identical. The difference between them is the rder in which they are prcessed when the query is run. The Having filter is always applied after the Gruping filter. A simple example wuld be where a cmpany has ffices in different lcatins. Srting Clumns may be added t the Srting pane t set the rder in which the query results are displayed. A clumn is added t the Srting pane using the same methds described fr the ther panes. When a clumn is added it cntains an arrw n the left side which indicates whether the srting rder is ascending (pinting upwards) r descending (pinting dwnwards). Duble-clicking n the arrw tggles it between up and dwn. The default srting rder when the clumn is first added is ascending. As further clumns are added they are displayed t the right f the last clumn entered and this is the rder in which they are implemented. Clumns may be re-rdered by dragging and drpping them t the left r right f anther clumn 18
Database Query (OLEDB) Tl SQL tab The SQL tab may be selected at any time t display the SQL script that is being created in the backgrund fr the Step as shwn in Figure 16 belw. Figure 16. Query tab SQL sub-tab. Request tab Figure 17. Query tab Request sub-tab. The Request tab (Ref: Figure 17) is nly displayed if a Nn-SQL OLEDB prvider is selected. The tl autmatically detects whether it supprts a different query language r n query language at all and then either allws the user t write a free type query if a query language is supprted r t enter a table name if n query language is supprted. 19
Database Query (OLEDB) Tl Results Figure 18. Database Query (OLEDB) - Results tab. The Results tab (Ref: Figure 18) fr the Database Query (OLEDB) dialg is used t display the results f the query when testing. The tab is autmatically selected and the results displayed when the Execute buttn is clicked n the Tlbar. The tab cntains the fllwing: 20
Database Query (OLEDB) Tl Optins Figure 19. Database Query (OLEDB) Optins tab. The Optins tab (Ref: Figure 19) is used t cnfigure the Step behaviur if an errr ccurs when the Step is being prcessed. The fllwing ptins are prvided fr selectin: Abrt Task - If there is an errr executing the query then the Task will stp and n recrdset is prduced. Cntinue - The Task will cntinue nt the next Step even if there is an errr executing the query 21