Fast Query System users guide Paragrafo-Pagina di Pagine 1-1 di 20 Versione 12 del 28/04/2010
Table of contents 1 Who is the User (destinatary)... 1-3 2 Pre-requirements... 2-3 3 Duration of Formation... 3-3 4 Conceptual introduction... 4-3 5 Contents... 5-4 5.1 Permissions Management... 5-4 5.2 Alias Management... 5-4 5.2.1 Access to Alias management:... 5-4 5.2.2 Generation of an Alias:... 5-6 5.2.3 Alias change:... 5-6 5.2.4 Joins management:... 5-8 5.2.5 Fields Management:... 5-8 5.2.6 Fields Addition:... 5-9 5.2.7 Fields Alignment:... 5-10 5.3 Fast Query applications management... 5-11 5.3.1 Access to F.Q management:... 5-11 5.3.2 Creation on an F.Q:... 5-11 5.3.3 Fields Selection:... 5-12 5.3.4 Fields Addition:... 5-13 5.3.5 Saved Application Use:... 5-15 5.3.6 Files Management:... 5-15 5.3.7 Customization of the F.Q. management:... 5-16 5.3.8 Data Base Generation:... 5-16 5.3.9 Creation of a drill down F.Q type:... 5-17 5.4 Cross query applications management:... 5-18 5.4.1 Creation of a Cross Query:... 5-18 5.5 F.Q link/ Programs... 5-19 5.5.1 Programs call from F.Q.:... 5-19 5.5.2 Call of F.Q. from a program:... 5-20 Paragrafo-Pagina di Pagine 1-2 di 20 Versione 12 del 28/04/2010
1 WHO IS THE USER All the management program users whose job is to consult given objects supported by the informative company system. 2 PRE-REQUIREMENTS The apprentice must be able to use Webgate400 interface and database and he has to know the SQL (Structured Query Language) basic notions. 3 DURATION OF FORMATION It takes you 3 hours and 30 minutes to learn all the illustrated objects, including the final test. 4 CONCEPTUAL INTRODUCTION Fast Query allows a not expert user to extract information from the application database and get dynamic views that, using the SOA (Service oriented Architecture), can be automatically integrated inside all the application screen. This operation lets the user acquire even all the available services in relation to information appearing on the screen. Paragrafo-Pagina di Pagine 4-3 di 20 Versione 12 del 28/04/2010
5 CONTENTS 5.1 Permissions Management To manage permissions to F.Q. management, set users using WEBGATECVT / Run Time Configuration, and 2 modyfing option next to the users. Permitted values. *blank = user authorized to the F.Q. execution only (default). Y = user authorized to F.Q. execution and creation. N = user not authorized to F.Q. use. S = Supervisor. The user can gain access to query and customized companies database, company, users, different languages. 5.2 Alias Management It permits to define the necessary database to make the Fast Query application working. Every Alias is a data structure connected to a database archive; each F.Q. displays real data from the database relying on the corresponding (similar)alias structure. A very careful Alias management is necessary to develop and execute F.Q. applications quickly. 5.2.1 Access to Alias management: Access with webgate400 user master (WEBGATECVT or WEBG4RXXXX according to the installed release), select Fast Query and then Database F.Q. management. For calling the archives list where you have to operate, load the application code. If you don't know the application code, search using the application code description. You must insert the Application Code field. Possibility to select other libraries, in addition to the first library which is automatically set by the system (connected to the Application Code) Paragrafo-Pagina di Pagine 5-4 di 20 Versione 12 del 28/04/2010
only generated : Possibility to visualize only the DataBase files and at least the correspondent Alias in the same time. File scanning : Possibility to make a specific search of a data base file name or of a database file description. New Record Values : Setting one or more available fields, each Alias in a creating stage will set the same parameters (parameters should be modifiable during the Alias data entry) The use of these fields will be explained in the next paragraph. Paragrafo-Pagina di Pagine 5-5 di 20 Versione 12 del 28/04/2010
5.2.2 Generation of an Alias: Option G ; this option must be called next to a database file. Record Standard: All the F.Q. database structures called standard during the software update creating stage, are deleted and substituted with those called standard by the producer. It's dangerous setting new structures, definitions, joins ect. in the customer's system because those get lost during the creating stage (unless the user takes the necessary cautions to save the archives before the installation). User Name, Group, Language, Company: Setting a value in one or more of these fields, the created Alias can be called, during the F.Q. creation stage, only by users with the same values. Specialization: It's a comment in addition; it's useful to get an Alias later if this Alias should have been modified; for example give a short description of the WHERE predicate (see: Change of an Alias ). File description: Set a description you can easily identify during the F.Q. creation stage. After you execute the function F1=Confirm, the Alias is created but not available. It's necessary to call it using the function 2 of Change. The Alias generated but not available by the option 2 can be identified by sign. This sign appears on the right in the 'Status column. 5.2.3 Alias change: Option 2 ; this option must be called parallel to an Alias; it doesn't work parallel to a Database file. Paragrafo-Pagina di Pagine 5-6 di 20 Versione 12 del 28/04/2010
PREDICATE WHERE: Definition: it is used to implement conditions that are verifiable (you can check) at a single row level. It is not changeable by the user while he is using an F.Q. and lets the user partialize the content of the file available to the F.Q. application; it corresponds to Omit and Select options in logical Database views. This predicate can be related to the file basic definition or to a specialization of it. In the example above, the Alias structure is set in this way: SPI movements files, only suppliers/service sector records dated from 01 of January 2009 to 31 of December 2009, order type. It is mandatory to select the character /\ ; (it will be substituted by the program during the F.Q. launching stage). Field finder: You can choose up to three fields that will be reproduced in Where Predicate. Flag file activation: Select the field to make an F.Q. able to recall the chosen Alias. When the Alias has been started, right icon in Status column change in. Paragrafo-Pagina di Pagine 5-7 di 20 Versione 12 del 28/04/2010
5.2.4 Joins management: JOIN definition: it is the combination of one or more arrays content and it allows to generate a group of results where you can visualize rows and columns of each array. Arrays are linked by common data. Option J ; this option operates only in the definition Base (the one without more clarifications). The codified Joins apply to all the Alias connected to a reference Database file. Later, run function F6=Add Join'. Secondary File name: sets database file that you want to link to the main file. Secondary File specialization: sets, if you want, a specific specialization of the secondary file. Type of JOIN: Inner Join: in this type of join arrays rows are combined only if the fields connected to joins meet a particular condition. Left Outer Join : in this type of join you can even extract those data, belonging to an array, impossible to extract using an Inner Join. In fact OUTER means exterior; outer data in comparison with a normal type of join. Exception Join: in this type of join you can extract data, belonging to the main file and not available in the secondary file, that you cannot extract using an Inner Join. Example: 5.2.5 Fields Management: Option C ; this option must be called parallel to an Alias. Calling this option in a new Alias for the first time, the system displays a list where you'll see all the fields of the correspondent data base. During a F.Q. creation stage, this list will be the supporting structure of the fields managing. Column A (activate): By default, each field is prepared using Flag = ; doing that, each field can be managed in each F.Q; leaving the flag *blank, the field cannot be managed in any F.Q. Column Category : It defines the type and importance of the field contained in a database. The type is defined by the first letter of the code while the second letter defines the importance. Paragrafo-Pagina di Pagine 5-8 di 20 Versione 12 del 28/04/2010
Value Example C1-C3 Field Code (ex. item code, customer, agent etc.) D1-D3 Field Description (item code, customer, agent etc.) T1-T3 Field Date Hour (item code, customer, agent etc.) I1-I3 Amount Field (Price, value, entry amount etc.) Q1-Q3 Quantity Field (Quantity order, coefficient of use etc.) A1-A3 Attribute (flag order payment, printed, accounting etc.) It can be used like partialization and ordering argument in the fields selection lists. Generally it is defined to make easier to the user to identify fields he need to use in his queries. Column D : Default fields management: Possibility to set the main important fields of the D.B. so that you can easily select them during a F.Q. creation stage with the given Alias. Column Field description : It s the field description that will be visualized in the F.Q; you have to modify descriptions so that you can understand them easily; you have to delete all the particular characters (brackets etc.). Column State : when field is set in column A : when field isn't set. Function F13=Copy Settings : Using this function, the system copies all the fields settings of a standard Alias. 5.2.6 Fields Addition: It is possible to add new computed fields in the Alias. These new computed fields could be managed in F.Q. connected to the Alias. Set a field name, a description and an SQL instruction. SQL Instruction: In addition to the standard instructions (DIGITS, SUBSTR, ect..), it's possible to use: Paragrafo-Pagina di Pagine 5-9 di 20 Versione 12 del 28/04/2010
WUF_DEC: Function for decoding fields described in dictionary and provided with a decoding routine. It returns a field containing the suggested code decoding. WUF_DAT: Function for dates management (8 positions long). returns an alphanumerical field, containing the date of the required format. The date is automatically turned upside down (normalized) by the function itself. WUF_DCA: Function for working out a date, starting from a date identified by a keyword. It returns a numeric field containing the date calculated in yyyymmdd format. WUF_TIM: Function for editing the Hour field. WUF_LOB: Function for reading LOB fields. To know better this syntax and to visualize examples about these three functions, go to help in Help Navigator; digit UDF and the name of the installation library of the application (WEBGATE400 or others) or use help key in the field Calculated field Expression. All the parameters in this screen are changeable, even from the main screen previously illustrated, except for two data. These two data are: "Calculated field expression" and "Changeable field flag". Changeable Field Flag: If it is set (it's impossible to set it on a calculated field), you'll be able to modify the Database data that is correspondent to the F.Q. calling the considered Alias. 5.2.7 Fields Alignment: Option A ; this option is used for loading in an Alias the new database fields of the considered file. It must be run after a new release (that has been run with) displaying a modified database. Paragrafo-Pagina di Pagine 5-10 di 20 Versione 12 del 28/04/2010
5.3 Fast Query applications management 5.3.1 Access to F.Q management: Access as in WEBGATECVT or WEBG4RXXXX (according to the installed release). Select Menu Environment/applications and later select Generation/ F.Q. running 5.3.2 Creation of an F.Q: First of all you must load the main Alias, setting icon Files / fast query and digiting a relevant characters statement. Press Action / Selection in correspondence with the Alias you want to manage. If at least a Join exists in a chosen Alias, an Alias list will be opened later. These Alias are linked to one another using Join. Press ; Paragrafo-Pagina di Pagine 5-11 di 20 Versione 12 del 28/04/2010
The secondary chosen files list will be displayed in the next screen: Confirm or not. Press proceed and the F.Q main screen appears: Standard screen has got the flag Category 1 set; so the listed fields are all those previously listed during the Alias management stage and of main importance. N.B: if no field of the Alias has been put in a category, the system displays all the fields defined as manageable. 5.3.3 Fields Selection: To search faster fields to take into the F.Q, you have to use searching, in addition to Categorization flags, using Description or Field Name. Then press Actions in the fields you want to manage. Paragrafo-Pagina di Pagine 5-12 di 20 Versione 12 del 28/04/2010
5.3.4 Fields Addition: Press Add ; SQL structure has got the same features / possibility as all the fields added during alias management stage. Explications in each columns. Sequence: It is the order of the columns view; Modifiable. Category: Information, positioning the cursor on values, about field category, if it is a key field, ect. Description: Columns heading; it derives from field descriptions about the Alias; Modifiable. Actions: First button to remove the field from the F.Q Displaying: Second button to move the field one row up (in the upper row) Third button to move the field one row down. Fourth button to entitle a drilldown (see paragraph 5.3.9). If it is set(default), the related column is displayed in the F.Q; in that way, you can manage a field in data selection and not visualize it in the final F.Q.. Functions: : this sign indicates an added field; press button to modify parameters in the added field. : Functions; Available functions list: Parallel to a alphanumerical field, you can use only Count. If whatever summary typology is set, the field is moved towards the Column function paragraph and all the other fields get a group field number. Paragrafo-Pagina di Pagine 5-13 di 20 Versione 12 del 28/04/2010
Activated Functions: It gives you the activated functions list. Group Position: Nine fields maximum; if they are set, the system gathers rows with the same group fields and displays horizontally the recquired type of totalization. Hierarchy: It is used to obtain a result with data displayed in a shaft disposition and no more horizontally in the same row. Order Position: It corresponds to the SQL 'Order By ; It orders data according to the group sequence. Descending order: If it is set, data order will be descending. Summary: Summary functions of the fields; result at printout bottom. Activated Summaries: Description of the activated summaries of the field. Graphic Axes: It permits to define the correlation between column (Field) basic elements in the graphic. Available Values: X (categories)=values in the column will be used to form the X axis. Y1=Values in the column, will be used to form values that are placed in Y1 axis and divided in single series or multiple series. Y2=Values in the column,will be used to form values that are placed in Y2 axis CS (change series)= Values in the column, will cause a new series formation when they change. Graphic will display as many series as the different values in the column. Decoding: It allows to move(transport) to(in) data view the description a chosen field. N.B: You can gain access to the decoding function only for those fields that are presented in DECOD file. For using Creation/Use DECOD file, go to the specific documentation. Records Choice: It allows to undergo to the F.Q. starting, a Select choice in the required fields.???????? Example: Save the parameters choice you have set, to make it activated in each launch of your F.Q. Modifing: If the field has been set as modifiable in the Alias, and setting flag, you can modify the datum with a value manually set by the user during the viewing stage of the F.Q. N.B: if the F.Q. is set through group functions, when you modify the value of a modifiable field, this modification will concern (affect) all the rows in a group. Paragrafo-Pagina di Pagine 5-14 di 20 Versione 12 del 28/04/2010
5.3.5 Saved Application Use: There is the possibility to operate manually in the SQL statement that has been created by the F.Q various parameters. Example: If you set Saved Application and press Run / See SQL ; you'll get the following screen: Press Recalculate : Screen will display the following data: Modifying the SQL structure, F.Q. will run the SQL structure so saved. 5.3.6 Files Management: It is a summary of fields and types of join used; There is the possibility, pressing Substitution (Change) ( open the F.Q. ), to set the specific element of the file on which you want to Paragrafo-Pagina di Pagine 5-15 di 20 Versione 12 del 28/04/2010
5.3.7 Customization of the F.Q. management: Press Set fields to allow the F.Q. accessibility only to the correspondent users. (Set fields so that only the correspondent user can gain the access to the F.Q.) If you set your F.Q. as Standard, in the next program release, the system will delete your F.Q. before it can be re-set. 5.3.8 Data Base Generation: Press This option must be set in F.Q that need to write the result in a file: set a file name and the library where the output file will be created. Option Recalculate : if you set always, the system will create ex novo the file, everytime the belonging F.Q will be called; if you set if required, the system will display a screen with the request of the F.Q. execution. The system, in addition to the creation of a required database file, creates even the correspondent Alias. You can manage this Alias pressing output Files. N.B: A F.Q. of data writing on file is placed in Query W/Output. Moreover, there is the possibility to set a program name to be launched at the end of the F.Q execution; details in paragraph 5.5.2 Paragrafo-Pagina di Pagine 5-16 di 20 Versione 12 del 28/04/2010
5.3.9 Creation of a drill down F.Q type: Press It allows to create drilldown F.Q. types. You can call these types using Navigate Bar or Alt + A keys combination. (Definition of a Drilldown: drill down operation allows you to start with data group highly summarized and go into details step by step, going through different levels of the database summarization). Before you gain access to this function, press function (optional) connected to the drill-down field. next to the field you want to define it as drill-down, and set the Set one or more fields to call the drilldown. The star key, placed at the beginning and/or the end of the field, has got the wildchar function. At the beginning of the field, it means " a field ending with...". At the end of the field, it means " a field starting with...". Before and after it means " a field containing...". Load the icon Path with a starting star key. Load Icon Path. Press Wizard to load the SQL structure to be launched in each screen where the field CLASS will be present. Set the function Choice too: Paragrafo-Pagina di Pagine 5-17 di 20 Versione 12 del 28/04/2010
5.4 Cross Query applications management: It is a query that displays data as a pivot array. 5.4.1 Creation of a Cross Query: Press Cross and then press New : Set the application code (it is mandatory), D.B file and data library (search all the D.B. created files using the row Fast query data origin ). Fields setting: For Pivot fields, Row fields and Data fields, you have to load, in the first field, the description that will be displayed in F.Q, then you have to load the real field name of the D.B. in the second field (search button). Pivot field: It is the D.B. field of the Pivot array; each value will be displayed in a new column. Row Field: Chose up to three fields to use as a reading key (organized into group); there is the possibility to make a hierarchy. Datum (data) Field: Set data you want to visualize in the Pivot field; maximum three fields. In each field you can set different typologies of the Amount(Total). Paragrafo-Pagina di Pagine 5-18 di 20 Versione 12 del 28/04/2010
Updating: If the D.B. file is a F.Q result, there is the possibility to run that F.Q. before the Cross Query execution. 5.5 F.Q link/ Programs 5.5.1 Programs call from F.Q.: As in paragraph 5.3.8., it is possible to set a program name to be called at the end of the F.Q. execution. In this case, at the end of this F.Q. execution, the call to the program TESTMM/FQ_COURSE will be made. N.B: This is possible only if F.Q. generates an output file. Paragrafo-Pagina di Pagine 5-19 di 20 Versione 12 del 28/04/2010
/* Procedure called from F.Q. "MM-ORDINATO 02" */ PGM DCL DCL DCL CALL MONMSG PARM(&LIB &FIL &UNI) VAR(&LIB) TYPE(*CHAR) LEN(10) VAR(&FIL) TYPE(*CHAR) LEN(10) VAR(&UNI) TYPE(*CHAR) LEN(18) PGM(DTW_H_OBJ/XGT42_TQHG) PARM(&LIB &FIL &UNI) MSGID(CPF0000) ENDPGM N.B. Entry parameters are mandatory (they must be necessarily defined in the user's procedure even if they are not used). 5.5.2 Call of F.Q. from a program: Example: PGM /* SET THE LIBRARY OF DataBase for F.Q. */ CALL PGM(RGBU02C) PARM(' ' ' ' ' ' + '001' ' ') /* Launch the F.Q. of Ouput */ CALL PGM(RFQX05) PARM(' ' '0315488EB651FA7BA6') /* CPYF to get back later all the following queries that have been created some time ago */ CPYF FROMFILE(SPI_EP/FQ_MAT01) TOFILE(SPI_EP/MOV) + MBROPT(*REPLACE) FMTOPT(*MAP *DROP) /* RUNQRY QRY(SPI_EP/MATER_0) RCDSLT(*YES) */ RUNQRY QRY(SPI_EP/MATER_1) RUNQRY QRY(SPI_EP/MATER_1_D) RUNQRY QRY(SPI_EP/MATER_1_2) RUNQRY QRY(SPI_EP/MATER_1A) 0315488EB651FA7BA6 = Unambiguous identifier F.Q. must have a Database file as output. Paragrafo-Pagina di Pagine 5-20 di 20 Versione 12 del 28/04/2010