Presentation on theme: "An End-User Perspective On Using NatQuery Building an Expression Variable www.natworks-inc.com T. 802 485 6112."— Presentation transcript:
An End-User Perspective On Using NatQuery Building an Expression Variable T
This session will skip over certain “steps” required for building and submitting basic queries. For a specific overview of; How to Build a Query, please refer to that Power Point Slide™ Show found on our web site Slide Show page. Our user wishes to know two pieces of information; unique employees living in specific cities and their total salaries. This example of NatQuery is being run against ADABAS on Linux in a PC network environment. The following screen shots may differ in your environment however the processing will be similar.
ADABAS database recurring fields are represented to the user by trailing parenthesis. The number of occurrences available to the user will be within these parenthesis's – PE’s or MU’s. A Field shown as; Bonus (All,All), tells the user that there are recurring fields within the Field – MU’s within PE’s.
To begin this query the user has chosen the logic: NAME – Equals – a List variable. Here we see the Define List Variable window and that the user is about to ADD the name ADKINSON #
When the user chose the Field, SALARY they noticed that there was the word ALL in parentheses. They know this means that there are multiple occurrences for this Field. The user wants the total of all occurrences so they will need to create a Variable such that all values of the reoccurring Field will be represented by a single occurrence in the output file. They begin the process by clicking the Variable icon and then clicking the Add button in the List Query Variable window.
In the Define Query Variable window the user can give their new variable a user friendly name, chose to include the variable in the outcome, and set the Length and Format. Choosing the Type and Value, in this case Expression, enables the Define Value button and will allow the user to begin creating the new variable.
This variable will come from the File EMPLOYEES that is found in the Field SALARY. This new variable will be an addition expression of the five occurrences that make up the Field SALARY. The user has added the first Occurrence and has now chosen Occurrence 2, clicking OK in the Specify Field Occurrence frame will set the #2 in the Expression Definition frame and enable the Operand options.
NatQuery recognizes that a pattern is developing in the users actions and now asks if they would like to “skip ahead” to the conclusion of the expected expression.
NatQuery has finished the expression and added a scroll bar to the Expression Definition window for the users optional review. At this point the user could also add, subtract, multiply, or divide another field, a variable, or a value to this expression. They may also check a box to a Conditionally Assign this variable if they choose.
The finished Expression value is shown in the Current Value of Variable frame, if acceptable the user will click the OK button.
The new variable is now part of this query and will be seen in the Query Selected Fields window after the user clicks OK in the List Query Variable window. Notice that an ellipse has been set in the new variable value to make up for the lack of room to show the entire expression in the window. The user should now click the OK button.
Note that the new variable now shows in the Query Selected Fields window because the user previously chose to include it with all the other extracted fields. The user is now ready to click the Send to Server icon. This example will skip over several of the submission and retrieval windows, assuming that the user is familiar with the individual processing steps needed.
Note that in the Database Field Information window the Recurring Field, Salary, will display each occurrence of that Field.
In the retrieved data shown here in the target Excel spreadsheet note that each occurrence of the Recurring Field Salary is shown in an individual column. Our example query goal was to show the Total of these recurring fields – which it does in the column Total Salary.
In order to remove the redundant fields in the output the user will need to go back to the source file and Modify the fields they wish to have returned. Start by highlighting the File that contains the field you wish to modify, in this case there is only one File to choose from. Then click the Modify button to bring up the Select Fields from Filename.
From the Select Fields to retrieve frame the user would highlight the Fields they wish to remove and then click the Delete button. Note that Total Salary is not included here because it is not a Field in the File, it is a specific user defined query variable that the user chose to include with the extracted fields when they created it.
Note that the Recurring Field Salary is no longer in the Query Selected fields window. The user is ready to resend this query to the server.
The Recurring Field Salary is not present in the Database Field Information window.
Here, the data has been downloaded into the target Excel spreadsheet and we see that the multiple salary columns have not been returned with the retrieved data.
URL: South Main Streetwww.natworks-inc.com Northfield, VT T Where do you need Your ADABAS Data today?