Fomin Report Builder
Transcription
Fomin Report Builder
Fomin Report Builder Users Manual 2005-2014 Scott Daughtry/Oleg Fomin Contents 2 Table of Contents Foreword 4 5 Part I Contents Part II Introduction 1 Overview: ............................................................................................................................................. Databases 7 2 Dictionary ............................................................................................................................................. 9 ........................................................................................................................................................................... 10 Dictionary: Functions (Others) ........................................................................................................................................................................... 11 Dictionary: Functions (Date/Time) ........................................................................................................................................................................... 12 Dictionary: Functions (Mathematical) ........................................................................................................................................................................... 13 Dictionary: Functions (String) ........................................................................................................................................................................... 15 Dictionary: Functions (Trigonometric) ........................................................................................................................................................................... 16 Dictionary: Operators (Arithmetic) ........................................................................................................................................................................... 17 Dictionary: Operators (Logical) ........................................................................................................................................................................... 19 Dictionary: Processed Files ........................................................................................................................................................................... 19 Dictionary: User Variables (Calculated Fields) ........................................................................................................................................................................... 20 Dictionary: User Variables (Gather Totals) 3 ReportFormatterWindow ........................................................................................................................................... 20 ........................................................................................................................................................................... 21 MenuToolbar ........................................................................................................................................................................... 22 ReportFormatterMenu ........................................................................................................................................................................... 22 ReportPropertiesWindow 4 Overview: Frames ........................................................................................................................................... 24 ........................................................................................................................................................................... 26 BreakPropertiesWindow ........................................................................................................................................................................... 27 Frame Properties Window ........................................................................................................................................................................... 28 Band Properties Window ........................................................................................................................................................................... 29 PropertyBoxWindow ........................................................................................................................................................................... 30 UpdateTotalWindow 5 Overview: Pictures ........................................................................................................................................... 31 ........................................................................................................................................................................... 33 Picture Wizard ........................................................................................................................................................................... 34 PictureDate ........................................................................................................................................................................... 35 PictureNumeric ........................................................................................................................................................................... 35 PicturePattern ........................................................................................................................................................................... 36 PictureScientific ........................................................................................................................................................................... 36 PictureString ........................................................................................................................................................................... 36 PictureTime ........................................................................................................................................... 37 6 Overview: Bands 7 Overview: ........................................................................................................................................... Filters 37 ........................................................................................................................................................................... 38 Overview: Filters Part 2 ........................................................................................................................................................................... 38 Overview: Filters Part 3 ........................................................................................................................................................................... 40 Overview: Filters Part 4 ........................................................................................................................................................................... 40 Overview: Filters Part 5 ......................................................................................................................................................................... 427 Overview: Filters Part 6 Part III Basics You Need To Know (aka: The Tutorial)! 44 1 Basics: ........................................................................................................................................... Overview 44 2 Basics: ........................................................................................................................................... Step 1 (Report Manager Screen) 45 2005-2014 Scott Daughtry/Oleg Fomin 3 Contents 3 Basics: ........................................................................................................................................... Step 2 (Create/Save A New Report File) 46 4 Basics: ........................................................................................................................................... Step 3 (Details & Frames) 48 5 Basics: ........................................................................................................................................... Step 4 (Modifying Frame Contents) 53 6 Basics: ........................................................................................................................................... Step 5 (Resizing The Detail Band) 54 7 Basics: ........................................................................................................................................... Step 6 (Adding A Page Header) 55 8 Basics: ........................................................................................................................................... Step 7 (Sorting Output) 58 9 Basics: ........................................................................................................................................... Step 8 (Functions & Pictures) 60 10 Basics: ........................................................................................................................................... Step 9 (Combining Info Inside A Frame) 63 11 Basics: ........................................................................................................................................... Step 10 (Multiple Sorting Levels) 67 12 Basics: ........................................................................................................................................... Step 11 (Filters) 69 13 Basics: ........................................................................................................................................... Step 12 (Filters Continued) 73 14 Basics: ........................................................................................................................................... Step 13 (Adding Graphics) 74 15 Basics: ........................................................................................................................................... Step 14 (Records Printed Counter) 75 16 Basics: ........................................................................................................................................... Step 15 (Page Breaks) 76 17 Basics: ........................................................................................................................................... Step 16 (Using Total Fields) 81 18 Basics: ........................................................................................................................................... Step 17 (Using Group Total Fields) 84 19 Basics: ........................................................................................................................................... Step 18 (Using Grand Total Fields) 87 Part IV "How To" Section 1 Frame........................................................................................................................................... Tricks 92 92 How To: ........................................................................................................................................................................... Modify Default Frame Settings 92 How To: ........................................................................................................................................................................... Combine Text And Database Fields 93 How To:............................................................................................................................................................................. Conditionally Print Text 94 How To:............................................................................................................................................................................. Date Fields 95 How To:............................................................................................................................................................................. Prevent MEMO Field Truncation 96 How To:............................................................................................................................................................................. Change a Frame's Border/Fill Properties 2 Header/Footer Tricks ............................................................................................................................................. 97 97 How To:............................................................................................................................................................................. Add Date & Time To Report Page 97 How To:............................................................................................................................................................................. Add Page Number Counter 98 How To:............................................................................................................................................................................. Different Page Footers 98 How To:............................................................................................................................................................................. Different Page Headers 3 Report Variations ............................................................................................................................................. 99 99 How To:............................................................................................................................................................................. Labels 100 How To:........................................................................................................................................................................... Mail Merge Report ........................................................................................................................................... 102 4 Sorting Tricks 102 How To:........................................................................................................................................................................... Descending Sort Sequence 103 How To:........................................................................................................................................................................... Multiple Sort Levels 5 User-Defined Variables ........................................................................................................................................... 103 103 How To:........................................................................................................................................................................... Creating User Variables 6 Misc........................................................................................................................................... Topics 105 ........................................................................................................................................................................... 105 Help File Modification History 105 How To:........................................................................................................................................................................... Save A Report 2005-2014 Scott Daughtry/Oleg Fomin Contents FORWARD The Fomin Report Builder (FRB) is a royalty free reporting tool created by Oleg Fomin for Clarion computer language programmers to include within Windows software applications that they create. Oleg Fomin is the copyright holder for this reporting accessary. Scott Daughtry is a longtime FRB customer that created an enduser's Fomin Report Builder help file for his customers. He offered that help file to Oleg, free of charge, to include with his FRB product in appreciation for the capabilities that FRB offered his clients. That original help file has since swelled into the 100 page user's manual before you. Scott, in no way, helped develop FRB - Oleg takes 100% credit for FRB! FRB is a fantastic reporting tool - it uses a very simple and understandable approach to building various types of reports that endusers can quickly understand and benefit from. The ability for customers to create/tweak their own reports is immensely useful to them - they don't need to wait months (or years) for an updated software version to include a new report - within an hour they can create it themselves to their own liking/reporting need. If you are new to FRB, it is highly advisable to at least skim this user's manual (which contains the same content as the context-sensitive help file that was distributed with your Windows software application). At a minimum, read the 'Basics You Need To Know (aka: The Tutorial), which walks you through creating a very generic report and then tweak it into a much more capable/polished report. Once you have mastered the FRB basics, the remainder of this user's manual then becomes a reference that can be pulled off the shelf (or opened within your favorite *.PDF file viewer) to answer a quick question. Happy (FRB) Reporting! 2005-2014 Scott Daughtry/Oleg Fomin 4 5 1 Contents Contents Introduction Databases - what are they? Dictionary Report Formatter Screen Frames Pictures Report Bands Filters Basics You Need To Know (aka: The Tutorial)! Overview Step 1: Reports Manager Screen Step 2: Create/Save A New Report File Step 3: Details & Frames Step 4: Modifying Frame Contents Step 5: Resizing The Detail Band Step 6: Adding A Page Header Step 7: Sorting Information Step 8: Functions & Pictures Step 9: Combining Info Into A Frame Step 10: Multiple Sorting Step 11: Filters Step 12: Filters Part Two Step 13: Adding Graphics Step 14: Adding A "Record's Printed" Counter Step 15: Page Breaks Step 16: Using Total Fields Step 17: Using Group Total Fields Step 18: Using Grand Total Fields "How To" Section Frame Tricks Change default frame settings (border, fill color, etc) Combine text and database field information onto a report page Conditionally print information onto a report page Date fields are printing five numbers - help! Prevent truncation of a MEMO field during printing How To: Change a Frame's Border/Fill Properties 2005-2014 Scott Daughtry/Oleg Fomin Contents 6 Header/Footer Tricks Add page number counter to the report page Add current date/time to the report page Different header on page one than remaining report pages Same footer text is printed until last report page is reached Report Variations Labels Mail merge form letters Sorting Tricks Multiple sort levels Sorting in descending sequence User-Defined Variables Creating/saving user defined variables Help File History Changes to this help file 2005-2014 Scott Daughtry/Oleg Fomin 7 2 Fomin Report Builder Introduction Databases - what are they? Dictionary Report Formatter Screen Frames Pictures Report Bands Filters 2.1 Overview: Databases Preface As simple to use as Report Builder is (really!), there are some database fundamentals that you should be comfortable with in order to get the most out of this powerful tool. It is one thing to blindly type information into a computer, but empowering yourself as to how a database program really works will greatly enhance the reports that you create (to get that information back out in a manner that you need). Database - Description A database is nothing more than a collection of information that is somehow related. A phone book is a great example of a database it is a collection of names/addresses/ phone number(s) for people and businesses in one physical area (usually a city, or an area code). So, a database would be all the names, addresses and phone numbers contained within a phone book. Database - Components A database file is comprised of two new terms: database records and database fields. Going back to the phone book once again, each person's name listed in the phone book would be a database record - it contains all the information for one person or business (their name, address, phone number(s), etc). The next name shown in the phone book would be a separate database record, and so on. A database record is made up of database fields. Using the phone book again as an example, we would have separate database fields for the following information: Individual/business name Street address Phone number A database could have only one field or it can have hundreds of fields - whatever it takes to store all the information required to group together all of that related data inside of one database record entry. 2005-2014 Scott Daughtry/Oleg Fomin Introduction 8 Database Index File A phone book is usually sorted on the name of the individual/business, beginning with the number 0, and ending with the letter Z. This type of sort is known as ASCENDING sequence. If you started at the back of a phone book and worked your way to the front (going from the letter Z to the number 0) this sort is called DESCENDING sequence. Sorting a database requires the creation of a second type of file known as a database index, which can also be called a database key. A database index is a file used by a database application to change how database information is displayed. Going back to the phone book example - every day the phone company creates phone numbers as people and businesses move into the city. Their name(s) are obviously not going to be in alphabetical order when the clerk creates their new phone number entry - a person named Jones may be first, then Joe-Bob's Barbeque is next, then Alpha-Beta Drugs may be third, and so on. Without a way of sorting this information a printed phone directory would be a total mess names would jump around the alphabet! The index file's job is to regain some structure and order to the information being input into the database. A database index file can be created using one database field, or several database fields. These file(s) are normally opened when the database is opened, and as each database record is added/deleted an identical action is performed on the index file. For the phone book example, the desired sort would be the individual/business name to be sorted in ascending alphabetical sequence. The field name used for the index would be the individual/business name. If your phone company were really customeroriented they could perhaps create section(s) in their phone book that were sorted on the street address - a new index created on that database field would be created/ used to print this new section of the phone book. Index file(s) are most commonly used in browse screens (a screen where all the database records are displayed in columns, sorted alphabetically for easy location of information) and reports. Relational Databases Index file(s) are also used to relate (aka: link) two or more database files together, which store different pieces of information that belong together. This type of database application is known as a relational database - two or more database file(s) relate to each other by means of a common database field, and an index file that links the two separate files together. An example of a relational database could be your bank account. When you first joined your bank you filled out a form with your name, address, work history, etc. The clerk typed this information into the computer, handed you a bundle of blank checks and thanked you for joining their bank. All this "initial" information is stored in a database. As you start writing checks to pay for things a transaction is created for the 2005-2014 Scott Daughtry/Oleg Fomin 9 Fomin Report Builder date it was written, the dollar amount, the date the transaction was posted to your account, the check number, etc. These transactions are stored in a separate database file. At this point we have one database that stores customer information (name, address, etc) and another database that stores transactions for each check cashed. In both database files is a field that contains the account number, and an index file is created for each database on this field. The two database files are related to each other by these index files created on the account number. Not all database applications require a relational database setup - if the information being tracked is simple (e.g. a grocery shopping list) then a single database file will contain all the data being monitored. However, all business type database systems rely on the relational database structure in order to keep track of a large quantity of information. Relational databases greatly reduce the amount of information being stored in database files, which keeps the size of the database file(s) small and increases the speed of the program when retrieving data. Finale This Report Builder can create reports from single database programs or relational database programs. 2.2 Dictionary The Dictionary provides access to everything you can add to a report page (with the exception of information that you manually type into a frame). It's interface is split into four basic categories: Processed Files: Add information stored inside of the application's database files. Others: Access to standard report page counters and programmer-defined information is found here. Standard: Use built-in functions to manipulate text and numbers. This section is 2005-2014 Scott Daughtry/Oleg Fomin Introduction 10 broken into six sub-sections: o Operators: Arithmetic o Operators: Logical o Functions: String o Functions: Mathematical o Functions: Trigonometric o Functions: Date/Time User Variables: Access to variables that you (or the programmer) has created and some report totaling variables is found here. This section has two sub-sections: o User Variables: Calculated Fields o User Variables: Gather Totals To select a Dictionary item you can either double left click the mouse on an item or click the check mark icon at the top left of the window (after highlighting your desired choice). 2.2.1 Dictionary: Functions (Others) This section of the Dictionary provides access to two types of items that can be added to your report: Functions: These are defined by the developer of this application - as shown above there are four functions that have been created, and made available, for the user to input a date or select a product or vendor from another application database. Your database application might not have any functions defined here. Usually a function will either ask you for information or to select an item from a list. Built-in Variables: By default there will are four variables available for use (as shown above). The developer of this application can add other variables (i.e. predefined text) for you to use in a report that would show up here (example: a variable that combines the first, middle, and last names stored in a database into a formatted variable string). To select a Dictionary entry you can double left click the mouse on the desired item or click the check mark icon at the top left of the window (after highlighting your desired 2005-2014 Scott Daughtry/Oleg Fomin 11 Fomin Report Builder choice). The Dictionary window will automatically close after a Dictionary function or built-in variable is selected. 2.2.2 Dictionary: Functions (Date/Time) This section of the Dictionary provides access to built-in functions that manipulate date or time data types: TODAY() - Returns the operating system date as a standard date. The range of possible dates is from January 1, 1801 (standard date 4) to December 31, 2099 (standard date 109,211). You can use a picture command to change the appearance of the return value. For example: cToday = format( TODAY(), @d01B ) CLOCK() - Returns the current time based upon your computer's BIOS time. DATE() - Returns a standard date for a given month, day, and year. The month and day parameters do allow positive out-of-range values (zero or negative values are invalid). A month value of 13 is interpreted as January of the next year. A day value of 32 in January is interpreted as the first of February. Consequently, DATE (12,32,97), DATE(13,1,97), and DATE(1,1,98) all produce the same result. The century for a two-digit year parameter is resolved using the default "Intellidate" logic, which assumes the date falls in the range of the next 20 or previous 80 years from the current operating system date. For example, assuming the current year is 1998, if the year parameter is "15," the date returned is in the year 2015, and if the year parameter is "60," the date returned is in 1960. For example, HireDate = DATE(Hir:Month,Hir:Day,Hir:Year); FirstOfMonth = DATE (MONTH(TODAY()),1,YEAR(TODAY())) would compute the first day of month DAY() - Returns day of month. Computes the day of the month (1 to 31) for a given standard date. For example, OutDay = DAY(TODAY()) to get the day from today's date; DueDay = DAY(TODAY()+2) to calculate the return day MONTH() - Returns the month of the year (1 to 12) for a given standard date. For example, PayMonth = MONTH(DueDate) to get the month from the date YEAR() - Returns a four digit number for the year of a standard date (1801 to 9999) 2005-2014 Scott Daughtry/Oleg Fomin Introduction 12 . For example, YEAR( today() ) AGE() - Returns a string containing the time elapsed between two dates. The age return string is in the following format: 1 to 60 days - 'nn DAYS'; 61 days to 24 months - 'nn MOS'; 2 years to 999 years - 'nnn YRS'. For example, nAge = AGE ( EMP:Birthday, TODAY()) would compare the database field EMP:Birthday against the computer date to return the persons age. To select a Dictionary item you can either double left click the mouse on an item or click the check mark icon at the top left of the window (after highlighting your desired choice). 2.2.3 Dictionary: Functions (Mathematical) This section of the Dictionary provides access to built-in functions that manipulate numbers. ABS() - Returns an absolute value from an expression. The absolute value of a number is always a zero. For example, C = ABS( A-B ). C would contain the absolute value of the difference of B subtracted from A INRANGE() - Compares a numeric expression for an inclusive range of numbers. Returns a value of true if the scope is met, and false otherwise. For example, INRANGE( nVariableName, 1, 5 ) would check if the variable 'nVariableName' is between the values of 1-5, and return true if so; the starting number to scan is 1, and ending scanned number is 5. INT() - Returns an integer value from a numeric expression. For example, INT( 8.5 ) would return a value of 8. LOGE() - Returns the natural algorithym. The natural logarithm of a value is the power to which e must be raised to equal that value. The value of e used internally for these calculations is 2.71828182846. For example LOGE(2.71828182846) returns 1; LOGE(1) returns 0 2005-2014 Scott Daughtry/Oleg Fomin 13 Fomin Report Builder LOG10() -Returns base 10 logarithm. If the value of the expression is zero or less, the return value will be zero. The base 10 logarithm is undefined for values less than or equal to zero. The LOG10 procedure returns the base 10 logarithm of a numeric expression. The base 10 logarithm of a value is the power to which 10 must be raised to equal that value. For example, LOG10(10) returns 1; LOG10(1) returns 0 RANDOM() - Returns random integer.Returns a random integer between the low and high values, inclusively. The low and high parameters may be any numeric expression, but only their integer portion is used for the inclusive range. For example, RANDOM( 22, 80 ) would return a random number between the numbers 22 and 80. ROUND() - Returns a rounded number. For example, ROUND( 5163, 100 ) would return the rounded number of 5163+100 (which is 5200); ROUND(657.50,1) returns 658; ROUND(51.63594,.01) returns 51.64 SQRT() - Returns the square root of a number. To select a Dictionary item you can either double left click the mouse on an item or click the check mark icon at the top left of the window (after highlighting your desired choice). 2.2.4 Dictionary: Functions (String) This portion of the Dictionary provides access to built-in functions that manipulate text strings. ALL() - Returns a text string that replicates itself a defined number of times. For example, ALL('A',5) would return the text string 'AAAAA'. CAPITALIZE() - Returns a text string with the first letter in uppercase and the remainder in lowercase. CHR() - Returns the ANSI character from an ASCII code. For example, CHR(122) would return 'z' 2005-2014 Scott Daughtry/Oleg Fomin Introduction 14 CLIP() - Returns a string with the trailing spaces removed. Commonly used to properly format names and addresses into a more aesthetic appearing text string; multiple database fields are combined together using the concatenation symbol (&) to form a formatted string. For example, the database field ADR:City that contains the city name 'Tucson' could be combined with the ADR:State field that contains 'Az'. Because the ADR:City database field has 30 spaces allocated to it, and only 6 positions were used for 'Tucson', the resulting output would resemble this on the report's printed page: Tucson Az not exactly appealing! Using the CLIP() function and the concatenation symbol you can use the CLIP() function like this: CLIP( ADR:City ) & ', ' & CLIP( ADR:State ) to make it print as expected on the report's printed page: Tucson, Az Note that there is a blank space after the comma to "push" the state over one position to avoid crowding the comma character. DEFORMAT() - Returns a string that contains the unformatted characters of a numeric string. For example DEFORMAT('999-53-9954') returns 999539954 FORMAT() - Returns a formatted string; knowledge of the PICTURE command is mandatory to make best use of this function. For example SSN = FORMAT( Emp: SSN,@P###-##-####P), which would properly format the database field EMP:SSN to a standard social security number. INLIST() - Returns the position of an item in a comma delimited list. For example, INLIST('D','A','B','C','D','E') returns a value of 4 LEN() - Returns the length of a string. For example, LEN('Scott Daughtry') would return a value of 14. LOWER() - Returns the lowercase version of a string. For example LOWER ('SCOTT Daughtry') would be returned as 'scott daughtry'. NUMERIC() - Returns a true or false. If a string contains only numbers a true is returned. For example NUMERIC('123') would be true, and NUMERIC('1,23') would be false. SUB() - Returns a portion of a string. You define where the starting and stopping positions are in the string. For example, SUB( 'Scott Daughtry', 1, 5 ) would extract positions 1-5 of the string, returning 'Scott'. SUB( 'Scott Daughtry', 7, 3 ) extracts 'Dau' - the starting position is 7, and the next 3 positions are extracted from that starting point. You can also work backwards on a string by assigning a negative starting position. For example, SUB( 'Scott Daughtry', -1, 3 ) would return 'try'. UPPER() - Returns an uppercase version of a text string. For example, UPPER ( 'scoTT') is returned as 'SCOTT'. VAL() - Returns the ASCII character numeric equivalent for an ANSI entry. For example, VAL('A') would return 65. To select a Dictionary item you can either double left click the mouse on an item or 2005-2014 Scott Daughtry/Oleg Fomin 15 Fomin Report Builder click the check mark icon at the top left of the window (after highlighting your desired choice). 2.2.5 Dictionary: Functions (Trigonometric) This section of the Dictionary provides access to built-in functions that manipulate numbers in a scientific manner. SIN() - Returns the trigonometric sine of an angle measured in radians. The sine is the ratio of the length of the angle's opposite side divided by the length of the hypotenuse. For example, eturns the trigonometric cosine of an angle measured in radians. The cosine is the ratio of the length of the angle's adjacent side divided by the length of the hypotenuse. For example, sineAngle = SIN( 45 * 3.142498712) COS() - Returns the trigonometric cosine of an angle measured in radians. The cosine is the ratio of the length of the angle's adjacent side divided by the length of the hypotenuse. For example, cosineAngle = COS( 45 * 3.142498712) TAN() - Returns the trigonometric tangent of an angle measured in radians. The tangent is the ratio of the angle's opposite side divided by its adjacent side. For example, TanAngle = TAN( 45 * 3.142498712) ACOS() - Returns the inverse cosine. The inverse of a cosine is the angle that produces the cosine. The return value is the angle in radians. p is a constant which represents the ratio of the circumference and radius of a circle. There are 2p radians (or 360 degrees) in a circle. For example, acos = ACOS( 45 * 3.142498712) ASIN() - Returns the inverse sine. The inverse of a sine is the angle that produces the sine. The return value is the angle in radians. p is a constant which represents the ratio of the circumference and radius of a circle. There are 2p radians (or 360 degrees) in a circle. For example, asine = ASIN( 45 * 3.142498712) ATAN() - Returns the inverse tangent. The inverse of a tangent is the angle that produces the tangent. The return value is the angle in radians. p is a constant which represents the ratio of the circumference and radius of a circle. There are 2p 2005-2014 Scott Daughtry/Oleg Fomin Introduction 16 radians (or 360 degrees) in a circle. For example, TanAngle = ATAN( 45 * 3.142498712) To select a Dictionary item you can either double left click the mouse on an item or click the check mark icon at the top left of the window (after highlighting your desired choice). 2.2.6 Dictionary: Operators (Arithmetic) This section of the Dictionary provides access to built-in functions that manipulate numbers/arrays/strings, and/or combine multiple values to add to your report. Addition - Add two variables together to produce a value. The addition sign (+) is used. Subtraction - Subtraction one variable from another to produce a value. The minus sign (-) is used. Multiplication - Multiply one variable against another to produce a value. The asterisk symbol (*) is used. Division - Divide one variable into another to produce a value. The slash character is used (/). Exponentiation - Raises one variable to the value of a second variable. The carat symbol (^) is used. Modulus Division - Returns the remainder of one variable divided by another variable. The percentage character (%) is used. Concatenation - Most commonly used to combine multiple strings together into one string, or multiple database fields and/or text into one string. You don't need to convert numeric values into a string before combining them with a text field - this is automatically taken care of. To select a Dictionary item you can either double left click the mouse on an item or 2005-2014 Scott Daughtry/Oleg Fomin 17 Fomin Report Builder click the check mark icon at the top left of the window (after highlighting your desired choice). 2.2.7 Dictionary: Operators (Logical) This section of the Dictionary provides access to built-in functions that conditionally manipulate information. Choose() - This function is used to perform a logical evaluation and return a value based upon the result. When a condition is evaluated to true the first return value is returned. If a condition is evaluated to false the second return value is returned. For example, CHOOSE( 1 > 2, 'A', 'B') would return 'B'; CHOOSE( INV:Sex = 'M', 'Male', 'Female') would return the text string 'Male' if the database field INV:Sex contained a value of 'M'. And - A boolean operator; used to combine 2 or more logical statements together. Used when you need/want multiple logical expressions to equal TRUE in order for something to occur. For example: INV:Sex = 'M' AND INV:State - 'Az' would require the database field INV:Sex to equal 'M' AND the INV:State database field to equal 'Az' for a value of true to be returned. If either database field did not contain these values then a return value of false is returned. The expressions are evaluated from left to right; if a value of false is returned then the subsequent expressions are skipped over, since a value of false has already been reached. If the INV:Sex database field did not contain a value of 'M' then the INV:State field wouldn't be processed at all - a value of false has already been returned. If the INV:Sex database field contained an 'M', but the INV:State database field contained something other than 'Az', then a value of false is returned, since both items must return a value of true. You can a very long expression with the AND operator. For example: INV:Sex = 'M' AND INV:State = 'Az' AND INV:Birthdate > '01/01/60'. Or - A boolean operator; used to combine 2 or more logical statements together. Used when a condition can evaluate to a value of false but processing is still 2005-2014 Scott Daughtry/Oleg Fomin Introduction 18 desired. For example: INV:Sex = 'M' AND Inv:State = 'Az' OR INV:State = 'Ak' would evaluate INV:Sex; if it equals a 'M' the INV:State field is evaluated. If it contained 'Az' an overall return value of true is reached. If it didn't contain 'Az' it is then checked for a value of 'Ak'. If it did, a an overall value of true is reached. Not - A boolean operator. Used in conjunction with the Greater Than, Equal To or Less Than operators. For example, INV:State NOT = 'Az'; INV:Age NOT < 45; INV: Income NOT > 30000. Xor - A boolean operator. Used when an expression can evaluate to true on one side of the equation, but not both. For example: A XOR B; true is returned if A is true OR B is true, but not both. Greater Than - The symbol (>) is used for this operator. When you want the left side of an equation to return a value of true. For example, INV:Quantity > 5 would return a true if the INV:Quantity database field was greater than 5. Lesser Than - The symbol (<) is used for this operator. When you want the right side of an equation to return a value of true. For example, INV:Age < 15 would return true if the database field INV:Age is less than 15. Equal To - The symbol (=) is used for this operator. When you want an exact match in an equation for a value of true to be returned. For example, INV:State = 'Az' would return a value of true if the database field INV:State contained 'Az' Not Equal To - The symbol (<>) is used for this operator. When you want a value of true returned when a variable does NOT contain a particular value. For example, INV:State <> 'Az' would return a value of true when it did not contain 'Az' Greater Than Or Equal To - The symbol (>=) is used for this operator. When you want a value to be equal to or greater than something. For example: INV:Sold >= 325 would return a value of true if the INV:Sold database field was equal to or greater than 325. Less Than Or Equal To - The symbol (<=) is used for this operator. When you want a value to be equal to or less than something. For example, INV:Sold <= 325 would return a value of true if the INV:Sold database field was equal to or less than 325. Note: Standard operators can be used to build complicated expressions when you want to "drill down" to highly specific data (which is normally the case). Make sure that the most important criteria is placed first that would (in theory) eliminate the majority of data when the database is scanned. This will speed up the remainder of the operational string when they are executed. Some expression examples: EMP:Sex = 'M' AND LOC:State = 'Az' OR Loc:State = 'Nv' AND EMP:Haircolor = 'Brown' STO:Location = 'Iowa' AND PAR:Vendor = 'Hasbro' AND PAR:Onhand <= 100 SAL:Total = INV:Itemprice * SAL:Quantity * SAL:Salestax To select a Dictionary item you can either double left click the mouse on an item or 2005-2014 Scott Daughtry/Oleg Fomin 19 Fomin Report Builder click the check mark icon at the top left of the window (after highlighting your desired choice). 2.2.8 Dictionary: Processed Files This section of the Dictionary provides access to database information to add to your report. Some database applications may have more than one database file that contains information; the screen capture above shows an example of three database files (Inventory History, Vendors, Products) that can be expanded to access their respective database fields. To select a Dictionary item you can either double left click the mouse on an item or click the check mark icon at the top left of the window (after highlighting your desired choice). 2.2.9 Dictionary: User Variables (Calculated Fields) This section of the Dictionary provides access to functions that the programmer of this application has added for you to add to your report. This section of the dictionary might not contain any items that you can select. To select a Dictionary item you can either double left click the mouse on an item or click the check mark icon at the top left of the window (after highlighting your desired choice). 2005-2014 Scott Daughtry/Oleg Fomin Introduction 20 2.2.10 Dictionary: User Variables (Gather Totals) This section of the Dictionary provides access to functions that the programmer of this application has added for you to add to your report. This section of the Dictionary might not contain any items that you can select. To select a Dictionary item you can either double left click the mouse on an item or click the check mark icon at the top left of the window (after highlighting your desired choice). 2.3 ReportFormatterWindow Shown above is the Report Formatter screen - think of it as a blank piece of paper that will contain all of the information (text, database information, and/or pictures) that you want sent to a printer. This screen is used to create a new report or modify an existing report. The screen is configured in three different sections; from top to bottom they are: Pulldown menu: A standard Windows-style menu Toolbar: A standard Windows-style toolbar displayed under the pulldown menu Workarea: Blank space where you add information to print onto a report page 2005-2014 Scott Daughtry/Oleg Fomin 21 Fomin Report Builder By default the Report Formatter screen is blank (as shown above). It is YOUR job to add the pieces of the report as you want them to be printed. A key point to remember is this: a report CANNOT change information contained inside the application's database file(s)! This means that you can create as many reports as you want and change them as many times as needed without fear of altering data stored in the database file(s). The Report Formatter screen used a standard Windows layout - a pulldown menu is displayed at the top of the screen, with a toolbar directly below with clickable icons for commonly used tasks. The mouse is used to add/move object(s) to the report; the right mouse button is used to modify an object that you place onto the Report Formatter screen. Important to know/remember: A report needs at least one Detail Band and one Frame added to the above screen to generate a report. 2.3.1 MenuToolbar The Menu Toolbar provides quick access to commonly used features inside the Report Formatter window. The screen capture above is labeled A-W (note: the real Report Formatter window does NOT display these letters, and is used only to make it easy to describe each button's function): A. Save changes and exit the Report Formatter window B. Lose changes and exit the Report Formatter window C. Create a new report file D. Open an existing report file E. Save the open report file F. Cut the currently selected frame G.Copy the currently selected frame H. Paste from the Windows clipboard I. Open the Font Selection pop up box J. Left align the text in the currently selected frame K. Center align the text in the currently selected frame L. Right align the text in the currently selected frame M.Horizontally spread the text in the currently selected frame N. Top align the text in the currently selected frame O.Center align the text in the currently selected frame P. Bottom align the text in the currently selected frame Q.Not used R. Add/remove the left border line from the currently selected frame 2005-2014 Scott Daughtry/Oleg Fomin Introduction 22 S. Add/remove the right border line from the currently selected frame T. Add/remove the top border line from the currently selected frame U. Add/remove the bottom border line from the currently selected frame V. Open the Fill Color pop up box W.Open the Border Color pop up box 2.3.2 ReportFormatterMenu The main menu of the Report Formatter resembles most other Windows applications the underlined letter is used with the ALT key to activate that menu choice. You can also use the mouse (and clicking the left mouse button) to select and activate a menu choice. The above screen capture shows all of the Report Formatter menu options on one screen. 2.3.3 ReportPropertiesWindow The Report Properties popup window "General" tab provides options to: o Define the Report Title (that is displayed in the Report Manager screen). Each report you create SHOULD have a Report Title added BY YOU to make it easy to locate the report in the Report Manager. The Report Title should be brief and describe the purpose of the report using plain language. o Define a Record Filter to limit the output to only database information that meets specific criteria. 2005-2014 Scott Daughtry/Oleg Fomin 23 Fomin Report Builder The Report Properties pop up window "Page Layout" tab provides options to: o Define the page size of the report page by using a drop list of choices: Letter 8 1/2 x 11 in Letter Small 8 1/2 x 11 in Tabloid 11 x 17 in Ledger 17 x 11 in Legal 8 1/2 x 14 in Statement 5 1/2 x 8 1/2 in Executive 7 1/4 x 10 1/2 in A3 298 x 420 mm A4 210 x 297 mm A4 Small 210 x 297 mm A5 148 x 210 mm B4 250 x 354 B5 182 x 257 mm Folio 8 1/2 x 13 in Quarto 215 x 275 mm 10x14 in 11x17 in Note 8 1/2 x 11 in Envelope #9 3 7/8 x 8 7/8 Envelope #10 4 1/8 x 9 1/2 Envelope #11 4 1/2 x 10 3/8 Envelope #12 4 1/2 x 11 Envelope #14 5 x 11 1/2 C size sheet 17 x 22 in D size sheet 22 x 34 in E size sheet 34 x 44 in Envelope C5 162 x 229 mm Envelope C3 324 x 458 mm Envelope C4 229 x 324 mm Envelope C6 114 x 162 mm Envelope C65 114 x 229 mm Envelope B4 250 x 353 mm Envelope B5 176 x 250 mm Envelope B6 176 x 125 mm 2005-2014 Scott Daughtry/Oleg Fomin Introduction 24 Envelope 110 x 230 mm Envelope Monarch 3 7/8 x 7 1/2 in 6 3/4 Envelope 3 5/8 x 6 1/2 in US Std Fanfold 14 7/8 x 11 in German Std Fanfold 8 1/2 x 12 in German Legal Fanfold 8 1/2 x 13 in Custom size o Spinboxes to manually define the report page width and height. o Page orientation (default is Portrait mode); the check box changes the report output to Landscape o Page margins (left, right, top, bottom) 2.4 Overview: Frames Preface Frames are used in the Report Builder to print something on the report page, to include: A database field used in the application A text string (such as a report header, column header, etc) A calculated field that is generated at run time A page counter The current date or time Total fields (such as total expenditure, dollar total, etc) ANYTHING that you want printed on a report page MUST be added via a Frame. A Frame is also how you gain access to the Dictionary screen, which contains your database file information and internal functions that enable you to manipulate information to achieve your reporting goal for highly formatted (and attractive) printed output. A Frame requires at least one report Band to to exist on a report page before it can be added to the report page. An unlimited number of Frames can be added to a report page (space permitting). Adding A Frame To A Report Page First ensure at least one report band (Detail Band, Group Footer or Group Header) Left click inside the report band that you want something to be printed; this will select the report band to receive the empty Frame Right click the mouse to display a pop up menu; from this menu select 'New Frame' A new empty Frame is now displayed inside the report band where you had previously left clicked the mouse: 2005-2014 Scott Daughtry/Oleg Fomin 25 Fomin Report Builder Moving/Resizing A Frame Resize: When a Frame is selected red blocks outline the Frame to indicate that you can stretch any of the corners to meet your printing size requirement. Move (Mouse): You can drag the empty Frame to a different location inside the report band by left clicking inside the empty Frame, then drag the empty Frame to the desired location. When dragging the empty Frame the border will turn completely red - release the left mouse button after moving the Frame to set it's final position. Move (Keyboard): Hold down the CTRL key and use the arrow keys on the keyboard to move the Frame in the desired direction (left/right/up/down). Frame Contents As described above, a Frame can contain many things (or combination of things). The Dictionary is the primary method of adding an object, via the Frame, onto a report page. You can also use the keyboard to manually enter information into a Frame (such as a report title or column title). If you use the Dictionary to add information to a Frame (ex: database field), you will notice that an equal sign (=) is automatically placed in front of the database field's name inside of the frame: If you remove the equal sign the Report Builder will generate a runtime error when the report is printed. This is because the equal sign is MANDATORY for adding a database field or using internal functions (to format information in a highly specific manner). Adding information from the Dictionary will automatically add the equal sign for you; only one equal sign is required, and it MUST be positioned as the first entry in the above screen. If you are adding text to a report (ex: a column title) via a Frame the equal sign is NOT required in the first position of the frame's contents: 2005-2014 Scott Daughtry/Oleg Fomin Introduction 26 Frame Border By default a newly added Frame has a box drawn around it: This makes the Frame easy to find (and move around) inside of that report band; however, you can remove any (or all) of the four sides of the box by clicking the appropriate toolbar icon to toggle that box side on or off (the first four toolbar icons): You can fill the Frame with any color that you desire to create colorful reports by first selecting the Frame, and then click on icon #5 (displayed above)- a pop up color selection window will appear to select the color for that Frame. The box line color can be changed by clicking icon #6 - a pop up color selection window will appear to select the color to apply to the selected Frame. Recap Frames are the ONLY WAY to add the following items to a report page: Report header page title Report footer page count Image files (ex: your company logo on the top of the report page) Database file information Text information (ex: column header) Frames can be placed anywhere on a report page. Frames require a report Band to be placed inside of. Frames can be resized as large or small as needed. By default a Frame has a border drawn around it that can be removed (one side at a time). A Frame can be filled with any color. 2.4.1 BreakPropertiesWindow The screen capture above shows the "Sort Expression" dialogue box (also known as the Break Properties" dialogue box). This pop up window is accessed by double leftclicking on a sorting band; it's purpose is to define what database field will be used to 2005-2014 Scott Daughtry/Oleg Fomin 27 Fomin Report Builder sort the content of that report band. To add/edit the database field that will be used in the sorting band click the blue button next to the entry field - this will display the Dictionary, which is the easiest method to select the desired database field to sort upon. 2.4.2 Frame Properties Window The above screen captures show the "Frame Properties" window which is used to: Tab #1 (General) Define the contents of a frame (e.g. database field, calculated field, static text) Optionally perform a "mail merge" with the chosen database field Load an image from the hard drive to print onto the report page Load an image stored inside the database (inside a Memo or Blob database field) Define the picture for the frame contents Enable the frame contents to print as multiline text Automatically resize (shrink) the bottom of the frame to close up blank gaps on the printed page Define the horizontal and vertical alignment of the frame contents Define if a border should be printed around the frame, and if so, which sides and what color Define the font type/size/format for the frame contents Define the width of the frame Optionally fill the frame with a color Tab #2 (Position) Fine tune the top left corner position of the frame Fine tune the exact width and height of the frame Fine tune the margins inside the frame Fine tune the number of lines of text inside the frame The above screens is accessed by double left clicking the mouse button on a frame. NOTE: The majority of these functions are duplicated inside the Report Formatter's 2005-2014 Scott Daughtry/Oleg Fomin Introduction 28 toolbar. 2.4.3 Band Properties Window The above screen captures show the "Band Properties" window that is used to define how a BAND will: Optionally be printed (by entering a value in the 'Print section, if expression evaluates TRUE' entry field) Optionally print a MEMO field after the current BAND is printed Optionally "mail merge" a database field into text that you define (e.g. A form letter to customers) Resize the BAND for it's top position on a report, or it's size and/or width How to handle Page Overflow (i.e. when the report page is full, how the information will be printed) An explanation of each of the primary options in this dialogue window: Print Selection, if expression evaluates TRUE: You can elect to only print information contained in the new report band when a specific condition evaluates to TRUE; for example, you may want to make information stand out for customers who are late on a payment; if you have a database field that tracks if their payment is 2005-2014 Scott Daughtry/Oleg Fomin 29 Fomin Report Builder late you could check for this; if late you can create a fancy text warning to draw attention to the account. Naturally you would use the Dictionary to help define the database condition that evaluates to TRUE for this action to occur. Explicit Page Overflow Before Band Printing: Print the Group Footer band when the selected database field data changes at the beginning of the next group of information (i.e. ALWAYS print this band when the selected field data changes at the BEGINNING of the next group of information). For example, if you have 10 database records and the first 3 equal "AZ", when the state database field changes value to "CA" the Group Footer is printed on the next page before database records containing State=CA are printed to the page. Explicit Page Overflow After Band Printing: Print the Group Footer band when the selected database field data changes at the end of that group of information (i.e. ALWAYS print this band when the selected field data changes at the END of that group of information). The next page that prints will contain new database field information. Print This Band At The Same Page With Prior: This attribute specifies that the Detail, or Group Header/Group Footer structure (contained within a Sorting Band) is ALWAYS printed on the same page as the band immediately preceding it in the Report Painter screen. This ensures that the structure is never printed on a page by itself, thus eliminating "orphan" bands. An "orphan" band in this case is defined as a Group Footer, or last detail item in a related group of items, that are printed on the following page separated from the rest of it's related items. Print This Band At The Same Page With Next: This attribute specifies that the Detail, or Group Header/Group Footer structure (contained within a Sorting Band) is ALWAYS printed on the same page as the band immediately following it in the Report Painter screen. This ensures that the structure is never printed on a page by itself, thus eliminating "orphan" bands. An "orphan" band in this case is defined as a Group Header, or last detail item in a related group of items, that are printed on the previous page separated from the rest of it's related items. Print After This Band The Text Field: This attribute is used whenever you wish to print a database field that is a large MEMO type database field, which are commonly used to contain large amounts of text (such as notes). A normal Frame will be unable to print a memo database field within it's defined space; by checking this feature the selected database field will be printed after the report band in it's entirety without truncation. If there is insufficient space to print all of the information the remainder of the field information will continue printing on the next page. For the vast majority of reports that you build the default values will work just fine. For examples on how to use the features to their fullest potential please reference the "How To" section of this help file for useful printing tips & tricks! 2.4.4 PropertyBoxWindow 2005-2014 Scott Daughtry/Oleg Fomin Introduction 30 The Property Box Window is used to add/edit an object on the report page inside of a Frame. By default it is empty (as shown above). You can manually type information into the Contents entry field (colored light blue), or click the button just to the right of the entry field to use the Dictionary to help add an object to the report. To modify how the report object is displayed on the report page click the Picture tab: This tab of the Property Box Window contains an entry field (colored light blue) that you can manually enter a picture for the selected object, or click the button just to the right of the entry field to use the Picture Wizard to help create the appropriate picture. If you leave the Picture entry field empty the object will print on the report page for the entire length that the object is defined - for example, if you selected a database field that is 30 characters in length, then it will occupy 30 positions on the report page. If you enter a picture that limits that database field's length (ex: @S10), then only that number of characters (ex: 10) in the string will print inside of that Frame. 2.4.5 UpdateTotalWindow The above screen capture shows the dialogue box used to create a variable (storied in the computer's memory) that can temporarily store numeric information (e.g. dollar sales; inventory count) as the report is being generated. This screen is accessed from the Dictionary. Each of the entry fields (as shown above) require information from you to define the information that is gathered as the report is being generated: Assign Name: This entry field is blank by default; the above screen capture shows TOT2:Quantity as the fictional name for this variable. It is a good idea to create a name that resembles the content of the variable, and use a standardized naming convention. It is also a good idea to use the standardized naming convention of PREFIX:NAME when defining variables; the prefix can be 1-4 characters in length; the colon character (:) is mandatory, and then a name that can be 1-12 characters in length. By using the same prefix name (e.g. TOT2) you will be able to more easily 2005-2014 Scott Daughtry/Oleg Fomin 31 Fomin Report Builder find and understand the variable's purpose in the Report Builder. Field/Expression To Total: Click the button to the right of the entry field to display the Dictionary to help select the database field(s) that you want to be added together as the report is being generated. Picture: Click the button to the right of the entry field to display the Picture Wizard to define how this variable will be printed onto the report page. Total Type: The drop list has the following options available to define what action to take on the "field/expression to total" database field that you selected: Sum Average Count Minimum Maximum Evaluate Evaluate On: The drop list has the following options available to define when to do something against the "field/expression to total" database field that you selected: o At each record retrieve o At the end of the group o At the end of the report o At the end of every page 2.5 Overview: Pictures A Picture is a way of converting information from it's original format to a different format. Pictures can be used for database fields, built-in variables, user-defined variables, and text that you enter onto a report page inside of a Frame. A Picture is defined/accessed for a report page object using the Property Box dialog box and then clicking the Picture tab: You can manually type in a Picture value or use the Picture Wizard (the blue icon next to the light-colored blue entry field). You can change a Picture at any time - remember that a Picture only changes how data is displayed on a report page - it won't change/ delete any database information. If you decide you don't like the Picture for a frame you can change it to something else and then use the print preview screen to see the result. Here are some sample pictures that are commonly used. Each Picture has sample data, and the resultant output listed by category: Numeric 2005-2014 Scott Daughtry/Oleg Fomin Introduction 32 @N9 4,550,000 @N_9B 4550000 @N09 @N*9 004550000 ***45,000 @N9_ @N9. @N9.2 4 550 000 4.550.000 4,550.75 @N_9.2B 4550.75 @N_9'2 4550,75 @N9.'2 4.550,75 @N9_'2 4 550,75 @N-9.2B @N9.2@N(10.2) @N$9.2B @N$10.2- -2,347.25 2,347.25(2,347.25) $2,347.25 $2,347.25- @N$(11.2) $(2,347.25) @N12_'2~ F~ @N~L. ~12' @N~£~12.2 @N~kr~12'2 @N~DM~12'2 @N12_'2~ mk~ @N12'2~ kr~ 1 5430,50 F L. 1.430.050 £1,240.50 kr1.430,50 DM1.430,50 1 430,50 mk 1.430,50 kr Nine digits, group with commas (default) Nine digits, no grouping, leading blanks if zero Nine digits, leading zero Nine digits, asterisk fill, group with commas Nine digits, group with spaces Nine digits, group with periods Two decimal places, period decimal separator Two decimal places, period decimal separator, no grouping, blank if zero Two decimal places, comma decimal separator Comma decimal separator, group with periods Comma decimal separator, group with spaces, Leading minus sign, blank if zero Trailing minus sign Enclosed in parens when negative Leading dollar sign, blank if zero Leading dollar sign, trailing minus when negative Leading dollar sign, in parens when negative France Italy United Kingdom Norway Germany Finland Sweden Scientific @E9.0 @E12.1 @[email protected] @E12_.4 1,967,865 1,967,865 1,967,865 .000000032 1,967,865 .20e+007 1.9679e+006 -1.9679e+006 3.2000e-008 1 967.865e+003 Date @D1 @D1>40 @D01 mm/dd/yy mm/dd/yy mm/dd/y 10/31/59 10/31/59 59/10/31 2005-2014 Scott Daughtry/Oleg Fomin 33 2.5.1 Fomin Report Builder @D10 @D11 @D12 @D13 @D14 @D15 @D16 @D17 @D18 yyyy/mm/dd 1959/10/31 yymmdd 591031 yyyymmdd 19591031 mm/yy 10/59 mm/yyyy 10/1959 yy/mm 59/10 yyyy/mm 1959/10 Windows Control Panel setting for Short Date Windows Control Panel setting for Long Date Time @T1 @T2 @T3 @T03 @T4 @T5 @T6 @T7 @T8 hh:mm 17:30 hhmm 1730 hh:mmXM 5:30PM hh:mmXM 05:30PM hh:mm:ss 17:30:00 hhmmss 173000 hh:mm:ssXM 5:30:00PM Windows Control Panel setting for Short Time Windows Control Panel setting for Long Time Pattern @P###-##-####P @P<#/##/##P @P(###)###-####P @P###/###-####P @p<#:##PMp @P<#' <#"P @P<#lb. <#oz.P @P4##A-#P @PA##.C#P 215846377 103159 3057854555 7854555 530 506 902 112 312.45 215-84-6377 10/31/59 (305)785-4555 000/785-4555 5:30PM 5' 6" 9lb. 2oz. 411A-2 A31.C2 Picture Wizard The Picture Wizard is defined/accessed for a report page object from the Property Box window, and resembles this: After clicking the blue icon (to the right of the light blue colored entry field) a popup wizard is displayed: 2005-2014 Scott Daughtry/Oleg Fomin Introduction 34 As shown above, radio buttons are available for all possible data types. After selecting the appropriate data type (by clicking on a radio button), click the NEXT button to continue the wizard process. After you have stepped your way through the wizard you can click the OK button to accept the newly formatted picture, or click the CANCEL button to lose the changes. Click on a hyperlink below to see how the wizard adapts itself based upon the radio button that was selected: Numeric Picture Wizard Scientific Picture Wizard Date Picture Wizard Time Picture Wizard Pattern Picture Wizard String Picture Wizard 2.5.2 PictureDate Shown below are screen captures of the Picture Wizard for the Date radio button; after making your selection click the NEXT button until there are no more screens left in the wizard: 2005-2014 Scott Daughtry/Oleg Fomin 35 2.5.3 Fomin Report Builder PictureNumeric Shown below are screen captures of the Picture Wizard for the Numeric radio button; after making your selection click the NEXT button until there are no more screens left in the wizard: 2.5.4 PicturePattern Shown below are screen captures of the Picture Wizard for the Pattern radio button; after making your selection click the NEXT button until there are no more screens left in the wizard: 2005-2014 Scott Daughtry/Oleg Fomin Introduction 2.5.5 36 PictureScientific Shown below are screen captures of the Picture Wizard for the Scientific radio button; after making your selection click the NEXT button until there are no more screens left in the wizard: 2.5.6 PictureString Shown below are screen captures of the Picture Wizard for the String radio button; after making your selection click the NEXT button until there are no more screens left in the wizard: 2.5.7 PictureTime Shown below are screen captures of the Picture Wizard for the Time radio button; after making your selection click the NEXT button until there are no more screens left in the wizard: 2005-2014 Scott Daughtry/Oleg Fomin 37 2.6 Fomin Report Builder Overview: Bands Bands are used by the Report Builder to generate information contained inside one or more database files of this computer application to a report page. There are eight different types of Bands available to you when creating a report: Page Header Band - Your report can contain only one page header. This report band is printed at the top of the output on each generated report page. Report Header Band - Your report can contain only one report header. This report band is printed at the top of the output on only the FIRST generated report page. Sorting Band - Your can have multiple Sorting Band details on a report. A sorting band may contain it's own header, footer and/or additional breaks. A sorting band is the mechanism for SORTING a report; it is also used to perform page breaks when a value changes within a database file. Group Header Band - This band is printed at the top of each page when the group break value has changed. Detail Band - You can have multiple DETAIL bands in a report. A detail band is responsible for retrieving database information required for the report and printing the data onto the report. . Group Footer Band - This band is printed at the bottom of each page when the group break value has changed. Report Footer Band - This band is printed at the bottom of the last generated page in the report. Page Footer Band - This band is printed at the bottom of each page in the generated report. Your report MUST have at least one Detail Band or Group Band (which can be either a Group Header or Group Footer) to print a useful report (i.e. one that contains database information). By default there are NO band's added to a new report - it is up to you to decide what band(s) are required to create the desired reporting output. 2.7 Overview: Filters Rarely do reports contain every database record's content; a report 'Filter' is how a report's output is reduced to only what is needed (e.g. instead of printing a list of every customer, the report will use a filter to only print customers who purchased something in the past 12 months). 2005-2014 Scott Daughtry/Oleg Fomin Introduction 38 Understanding database filters is crucial to printing useful reports that print only the information that is required for your needs. Once you learn some basics of database filters you will find them extremely useful in building your reports - they are very easy to use! Some database programs may provide a "Query Wizard" that enables you to easily create / use / save database filters. If this is the case with this database application then please consult it's documentation on how to use this Query Wizard feature; note that you don't have to use the Query Wizard and can instead use a Report Builder filter if so desired. This help file breaks down database filters into smaller pieces to help you in understand what a filter is and how to create increasingly complex filters. It is recommended that you at least glance over each topic; if you get stuck you can always reference these help topics when creating your own database filter: Filters Filters Filters Filters Filters 2.7.1 Tutorial Part Tutorial Part Tutorial Part Tutorial Part Tutorial Part 12345- What is a database filter? What are the components of a database filter? Simple filters to get started Stopping common filter problems before they start Combining multiple conditions into one filter Overview: Filters Part 2 A database filter enables you to extract information from database file(s) that you want to print on the report's page. The ability to use filters has always been one of the strongest features of database applications (dBase, Foxpro, Access, etc), as filters allow you to limit the output of a huge database into a very specific report. While they can be a little confusing at first, if you understand some basic concepts of how to create a database filter you will find them to extremely helpful in creating useful reports (and have them mastered in no time at all)! Important Note: Filters do not change any information contained in database file(s); they don't copy information to another file either. A filter simply "hides" information that you don't want to see, which explains why they are called "Filters". No matter how many times you create or use a database filter, you are guaranteed that they will NEVER harm your database information. Hopefully this will give you the confidence to try creating filters for various purposes. 2.7.2 Overview: Filters Part 3 A filter relies on 3 pieces of information to work: 2005-2014 Scott Daughtry/Oleg Fomin 39 Fomin Report Builder 1. A field name from the database 2. An operator symbol 3. The text string or number to compare the selected database field against Let's examine each of these 3 pieces a little more closely: The database field name is defined in the the database structure. If you haven't read up on databases and what they are made of click HERE for an explanation. The Report Builder doesn't assume that you haven't memorized the structure of each database file in your application; the Dictionary window allows you to choose the database field from a list of every database field that the application uses. For this small example, let's assume that you have a database field named "City"; it is 2 character positions long and contains only text abbreviations ("az", "ca", "tx", etc) of the 50 states in the United States. An operator symbol tells the Report Builder what you want to do with the database field that you've chosen from the dictionary. Again, the Dictionary helps you by displaying a list of every operator that are available for building filters. You select an operator symbol based upon the type of information contained in the database file. Some operators are used only on text (such as "="); some are only used on numeric information (such as ">", "<"). For this example we have chosen a text field, so we will use the equal sign for the operator symbol. The last piece of the filter is one that you provide; only you know what information you want to extract from the database! For this example let's assume we want to print a report of only those customers living in Texas; the abbreviation for Texas is "tx", so we will use "tx" as the last piece of the filter. So, our first filter example looks like this: INV:State = 'tx' Granted, this is a very simple filter, but it clearly shows all 3 filter components - easy, right?!? Let's modify the filter to use a numeric field and a numeric operator. Let's assume that we want to print a report of all customers who have at least a $5000 line of credit with our company. A sample filter would resemble this: CUS:LINEOFCREDIT > 5000 Again, this is a very simple filter that shows how a filter is structured. 2005-2014 Scott Daughtry/Oleg Fomin Introduction 2.7.3 40 Overview: Filters Part 4 In the previous tutorial page some simple filters were shown to help you understand the components of a database filter. A database filter can be very simple or fairly complex - it depends on the type of report that you are attempting to create. In their most simple form database filters can be used for three different situations: You are extracting information based on text You are extracting information using numbers You are extracting information based on a logical condition Here are some sample situations and a simple database filter for each: 1. Customers who drive a BMW: 2. Products made by MierWater: 3. Items with an onhand quantity greater than 20: 4. Children who are too young to be in Kindergarten: 5. Customers who have pets: 6. Items with no detailed information available: CUS:CarType = 'bmw' ITM:Company = 'mierwater ITM:QtyOnhand > 20 Nam:Age < 7 NAM:Pets = 1 ITM:Detailed = 0 The six above example filters above are very simple in their structure but some interesting details become apparent: The first 2 filters for Text-type filters require a quote symbol (') before and after the text string that you are comparing against the database field ('bmw'; 'mierwater') The next 2 filters for Integer-type filters don't use a quote symbol; quote symbols will change the integers (aka: numbers) into a text string so they cannot be used here The last 2 filters for Logical-type filters use either a 0 (False) or 1 (True) to indicate true or false. This is because the information for this database field is stored as a one position integer (aka: number) in the database. For those of you with dBase experience this is quite different than what you are used to, as dBase stores a value of true as "Y" or "T" and a negative value as "N" or "F". 2.7.4 Overview: Filters Part 5 In the previous help topic some increasingly complicated filters were displayed. While structurally correct, they could use some modification to make them 100% reliable. You never know exactly how database information is stored; while some database programs have very strict safeguards incorporated in them to ensure data is highly structured, most don't. It is better to think defensively and create database filters that will work correctly in any situation instead of assuming everything within the report is all that existed within the database. 2005-2014 Scott Daughtry/Oleg Fomin 41 Fomin Report Builder Let us assume that a database program tracks customer sales. The data entry screen allows you (or your sales staff) to type in the customer name, their address, phone number, etc. Let us assume that the boss wants a report printing all customers living in Burbank; a simple filter should work: CUS:City = 'Burbank' The filter above looks correct, and would work IF the data entry clerk ALWAYS typed in the city named 'Burbank' the same way every time. However, what would happen if the CapsLock key was turned on for one data entry session and the clerk typed in 'BURBANK' for several dozen customers? If you guessed that the above filter example wouldn't work 100% of the time you would be correct! That is because the comparison of the database field CUS:CITY must EXACTLY match the text string 'Burbank' as it is currently defined; however, there are several ways of fixing this common problem. For example, if you wanted to create a lot of work for yourself you could define the filter like this: CUS:City = 'Burbank' or CUS:City = 'BUrbank' or CUS:City = 'BURbank' or CUS:City = 'BURBank' or CUS:City = 'BURBAnk' or CUS:City = 'BURBANk' or CUS:City = 'BURBANK' Thankfully there is a much easier (and reliable) way of fixing this problem and ensure the filter works 100% of the time!! By using the functions UPPER() or LOWER() you can define the filter like this instead: upper(CUS:City) = 'BURBANK' -orlower(CUS:City) = 'burbank' Either filter method is guaranteed to work 100% of the time because you are forcing the database field's contents to only one specific text case that can be exactly compared against. You will also greatly increase the operational speed of the filter by using the upper() or lower() functions instead of using the previous very long filter example. To learn more about the built in functions in the Report Builder click HERE. The important thing to consider here is this - never take for granted that database information will be typed in exactly as you think it is. The Capslock key can cause you a great deal of grief, but the built-in Report Builder functions can quickly solve this problem for you! 2005-2014 Scott Daughtry/Oleg Fomin Introduction 2.7.5 42 Overview: Filters Part 6 As mentioned before, database filters can be very simple or complex; it depends on the situation. To accommodate more complex filter situations you must used BOOLEAN OPERATORS within the filter condition. These are used to "join" together multiple database filter conditions (also known as Expressions). As you may have guessed, it is important to know how to properly use a BOOLEAN OPERATOR to achieve the desired result. There are only a handful of BOOLEAN OPERATORS; you will use only 4 of them to create complex filter conditions: 1. AND 2. OR 3. NOT 4. XOR Let's use some example situations and display what a sample filter would be for each: 1. Customers from Texas that make over $50000 a year: upper(CUS:State) = 'TX' AND CUS:Income > 49999 2. People who like ice cream or truffles: CUS:IceCream = 1 OR CUS:Truffles = 1 3. Cars that can be any color except orange : upper(INV:Color) NOT = 'BLACK' Notice that every time we are comparing a text string (such as the state field) against a database field's contents that the function UPPER() is used. This is a good practice to get into; whenever your filters are using/comparing text use the UPPER() or LOWER() functions. Notice that the CUS:IceCream and CUS:Truffle fields are true/false fields; a value of one means that the field is TRUE (a value of zero would mean false). Notice that the NOT operator is used with the equal sign; this BOOLEAN OPERATOR is most commonly used with another CONDITIONAL OPERATOR (greater than, less than, equal to). It is important to understand that there is an order of precedence involved when combining two or more expressions into one filter. A simple definition for "precedence" can be "what the computer will look for first in the database". There are five levels of precedence: Level 1: Parenthesis characters that surround a portion of a filter expression Level 2: Conditional operators (<, >, =, etc) 2005-2014 Scott Daughtry/Oleg Fomin 43 Fomin Report Builder Level 3: NOT Level 4: AND Level 5: OR When the filter expression is evaluated the precedence order will determine the result of the filter. The filter always returns a value of either TRUE or FALSE; either the database field(s) matches what you are checking for or it doesn't! There is no other result that a filter can return. Keeping this in mind here are some additional filter examples: upper(CUS:Car) = 'FERRARI' Above we are checking for customers who own cars made by Ferrari; if their car is a Honda then the filter condition returns a value of FALSE, and won't be selected for printing on the report. Let's modify the filter to check for 'Ferrari' and 'Lotus' automobiles by using a BOOLEAN OPERATOR: upper(CUS:Car) = 'FERRARI' AND upper(CUS:Car) = 'LOTUS' In this example the BOOLEAN OPERATOR of AND is being used. However, let's examine what is happening, and why the above example will fail. The BOOLEAN OPERATOR of AND means that both expressions MUST return a value of TRUE for that database record to be selected. There is no way a car can be both a Ferrari AND a Lotus so that database record will be skipped! We need to change the BOOLEAN OPERATOR to use the OR operator so the filter looks like this: upper(CUS:Car) = 'FERRARI' OR upper(CUS:Car) = 'Lotus' If the car isn't a Ferrari the OR BOOLEAN OPERATOR will continue evaluating the filter expression, since a value of TRUE isn't required for the first part of the expression. Therefore if the car is a Ferrari or a Lotus that database record will be selected for printing. You can create very long filters by using BOOLEAN OPERATORS; some examples: Male customers over 30 who drive a Lincoln or Cadillac automobile upper(CUS:Sex) = 'M' and CUS:Age > 30 AND upper(CUS:Car) = 'Lincoln' or upper (CUS:Car) = 'Cadillac' Clients between the ages of 30 and 40 CUS:Age > 29 AND CUS:Age < 41 2005-2014 Scott Daughtry/Oleg Fomin 44 3 Fomin Report Builder Basics You Need To Know (aka: The Tutorial)! The hyperlinks shown below will teach you how to create a very generic report (steps 1-3), modify the generic report into a more useful report (steps 4-9), and then perform add more sophisticated features for a complicated report (steps 10-18). Overview Step 1: Reports Manager Screen Step 2: Create/Save A New Report File Step 3: Details & Frames Step 4: Modifying Frame Contents Step 5: Resizing The Detail Band Step 6: Adding A Page Header Step 7: Sorting Information Step 8: Functions & Pictures Step 9: Combining Info Into A Frame Step 10: Multiple Sorting Step 11: Filters Step 12: Filters Part Two Step 13: Adding Graphics Step 14: Adding A "Record's Printed" Counter Step 15: Page Breaks Step 16: Using Total Fields Step 17: Using Group Total Fields Step 18: Using Grand Total Fields 3.1 Basics: Overview This tutorial will explain how to design a very simple report and then gradually add new features to the same report to show how to create increasingly more sophisticated reports. Even though the database files used in the tutorial are different than yours, the steps involved are still the same. The database file structure for the tutorial is very simple: FIELD NAME NAM:Lastname NAM:Firstname NAM:Middle NAM:Adrs1 NAM:Adrs2 NAM:City NAM:State NAM:Zipcode DESCRIPTION First name Last name Middle Initial Address Line 1 Address Line 2 City State Zip Code 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! NAM:Country 45 Country Note: Some tutorial help topics may use different database file structures as needed to provide adequate instruction. Later in the tutorial a report using two database files that are related to each other (aka: a relational database) will be used to show how to create more advanced reports. 3.2 Basics: Step 1 (Report Manager Screen) On the previous page the database structure was described - only 9 fields are used in this small database. Most likely this database program will have more fields, but nine fields are enough to learn with. It is assumed the fictional database application is open at this point, and you have selected the Reports Manager option from the application's pull down menu. This will display a screen similar to this: The above screen capture is called the "Reports Manager" screen. It keeps track of all the reports that have been designed for/by you for this software program. Reports are saved in an application sub-folder named REPORTS; the category for this report is "Report On Name". The category name will be different for your software program, but the remainder of the screen will look pretty similar (depending on your programmer's artistic tastes for colors, button size/icons, etc). Reports you create are saved as individual files with a file extension of *.RPT in the \REPORTS sub-folder that this database program is installed to. The Reports Manager also shows detailed information about the saved reports (date/time of creation, file size). 2005-2014 Scott Daughtry/Oleg Fomin 46 Fomin Report Builder Depending on the complexity of your database program, there may be several categories displayed above, with multiple reports created for each category. Because the Reports Manager uses a "tree" style browse you can easily expand/contract the "tree" branch to locate the desired report. Beneath the browse area are various buttons that allow you to print the highlighted *.RPT report file, expand/contract the reports "tree", create a new report, change the highlighted report, delete the highlighted report and close the Reports Manager window. To create a new report click the INSERT button. This will display the Report Formatter screen to create/modify report(s). 3.3 Basics: Step 2 (Create/Save A New Report File) If you've not familiarized yourself with the Report Formatter screen you need to right now (and then return here). There are two goals for any report that you create; it must 1. Properly extract information that you need 2. Be visually pleasing The second goal is sometimes elusive; everyone has their own opinion on how reports should look. The first goal is much simpler (once you understand how the Report Builder "engine" works). It helps some users to think of a Report Builder as a big circle. Inside the circle is the information that you (or your users) have inputted into the database. Using a DETAIL BAND in the report will start at the top of that circle (at the first database record), then loop through all the inputted information until the last database record is reached, bringing you back to the top of the circle once again. A DETAIL BAND is normally used for doing the "grunt work" of accessing the database, retrieving the database information and printing the database field in the area that you tell it to (aka: going around the circle). Almost every report that you create will have a DETAIL band in it. While there are many different types of report "bands" that you can use, a DETAIL band (or a Group band) is mandatory - without one of those two types of report band the reporting 'engine' won't know how to cycle through the database's contents (from the first database record to the last). Before adding a DETAIL band let's define some basic information about the report. 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 47 Click the main menu option titled FILE, then select REPORT PROPERTIES from the drop down menu. A window will appear asking you for the Report Properties. The Report Title is the report's description that will be displayed in the Reports Manager window - you want to give a meaningful description so that others can understand in this entry field. The Record Filter entry field allows you to use the Data Dictionary to assist in creating a filter condition. Record Filters will be described in much more detail in later lessons - in a nutshell a filter allows you to print ONLY the information that you desire (such as: print all names for customers living in Hawaii). Here is what the screen looks right now: Click on the second tab labeled "Page layout"; on this tab you can override the default settings for the generated report. The default settings are for 8.5x11 portrait output, with small margins on all 4 sides of the generated report page. You can also change the report orientation to landscape by clicking on the Landscape check box. For now the default settings will be used. Here is the screen: Click the SAVE button to save the report page information. At this point we need to save the report to the *.RPT file that is stored in the \REPORTS directory. Click the FILE main menu option, then select the SAVE AS menu option. A window will appear onscreen that you've seen in other Windows applications - you are being prompted for a location to save the file and a unique file name for the file. The default folder to save the report definition file to will be the \REPORTS folder located directly "underneath" the location where your database program is installed to. This is the desired location for ALL reports that you create - ALWAYS save your reports in the \REPORTS folder! For the file name you want to create a unique file name for all new reports. You can use the Windows 95/98/NT long file names if you want, or give it a 8 character file name - the choice is yours. Leave the *.RPT file extension alone - you 2005-2014 Scott Daughtry/Oleg Fomin 48 Fomin Report Builder do NOT want to use a file extension different that *.RPT!! For this report a file name of PEOPLE1 will be given, with the screen resembling: Now that the file name is input the OK button is clicked to save the report file. The report's file c:\clarion5\frb\reports\people1.rpt is now saved to the hard drive. Each report that you create must be saved to a DIFFERENTLY NAMED *.RPT file. You will also notice that the top of the report painter window now displays some of the information that was just entered above: To recap: on this page you learned: Generically speaking, every report needs a DETAIL band to extract/print database information How to create a new report file and save it to your computer's hard drive How to change the dimensions of a report (from portrait to landscape, etc) How and where report files (*.RPT) are saved on your computer 3.4 Basics: Step 3 (Details & Frames) Now we are ready to define the DETAIL band for this sample report. To recap, the DETAIL band performs the data retrieval from the database and inserts database field contents into the desired location in your report. SUGGESTION: Sometimes it is a good idea to draw the sample report on a piece of paper to help you "visualize" how the report needs to look when it is generated. If you are creating report(s) for other people you definitely need to discuss with them how they want their reports to look like to determine how information will need to be extracted from the database file(s) and then placed onto the report page(s). If you haven't familiarized yourself with FRAMES you need to now! At this point in the report creation process the Report Formatter workarea inside the 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 49 Report Builder is completely blank - only the top menu and toolbar buttons visible. Click on the BAND main menu option, select NEW and then select DETAIL from the menu options. Notice that the Report Formatter screen now has a rectangular box with red boxes at each corner and the top/bottom middle. A ruler bar is now displayed to the left of the rectangular box also. The red rectangles allow you to resize the size of this report band - we'll leave it alone for now. Now database fields need to be added to the DETAIL band. Database fields are placed inside of FRAMES - a FRAME tells the Report Builder engine how and what to print in the location where the FRAME is placed inside of a report band. There are two ways of adding a FRAME to the DETAIL band - you can select from the main menu "Frame", then "Create" - an empty FRAME is then created inside the DETAIL band at the top left of the DETAIL band. An easier way to create an empty FRAME is to place the mouse in the area where you want to print the contents of a database field; right click the mouse to display a pop-up menu; select the menu option titled "New Frame", and an empty frame will be created in the location where the mouse is positioned inside the DETAIL Band. You can move a frame at any time (e.g. after it's been placed inside of a report band or after you have defined what type of information the frame will contain [e.g. text or the contents of a database field]). To move the frame with the mouse left click anywhere inside the frame, and while holding down the left mouse button drag the Frame to the desired location. You can also use the keyboard to move the frame by holding down the CTRL key and use the arrow keys to move the frame in the desired direction. Here is what the screen looks like for now: To add text to a frame left click the mouse once inside the CONTENTS entry field in the FRAME properties box; as information is typed it will be displayed inside of the FRAME. If the length of the text is longer than the frame you can resize the frame by clicking on the right middle red box; while holding down the left mouse button drag the box to it's desired new size. The mouse cursor will change shape from an arrow to a double arrow, which means you can resize the FRAME in the directions of the arrow by left click-dragging the mouse. For now we are just adding the database fields to the DETAIL band; left click on the button with the flashlight inside it to display the dictionary When the dictionary appears onscreen click the tree expand box directly underneath the 'Processed Files' description. A list of all database fields is displayed onscreen for you to choose from: 2005-2014 Scott Daughtry/Oleg Fomin 50 Fomin Report Builder To select a database field double left click on the field name description; for this example the "Last name" tree 'node' (i.e. 'choice') is double left clicked to transfer the contents of that database field into the selected frame. The dictionary window will disappear, and the Frame Properties window is now updated with the database field information: Notice that an equal sign (=) is displayed in front of the field name (NAM:lastname) Also notice that the inside of the frame is displaying dollar signs ($). The dollar sign symbols are displayed onscreen to help you resize the frame size for this database field within the report band. At this point the steps for adding a new frame and populating the frame are repeated for each of the remaining database fields that you want printed onto the report page. After moving the mouse to the desired location inside the DETAIL band I am right clicking the mouse, selecting "New Frame", select the desired database field, and then dragging the frame to be to the right of the last added frame. All frames will be located at the top of the DETAIL band. For the Middle Initial field I resized the frame to accommodate a single character (A-Z) since the frame is a lot wider than it needed to be for this report. There is not sufficient space to have all the frames at the top, so the COUNTRY field had to be left off of the report. Here is what the screen looks like: Not too pretty, huh? We need to move the frames so they are aligned at the top for a nicer looking report. The Report Builder features a very easy way of aligning frames in many different ways. You can choose to move each frame yourself using the mouse, or the keyboard, but this can be very time consuming - there is a much easier way! The first thing to do is select all the frames on an imaginary line that you want the data 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 51 to be printed on. To do this you will left click the leftmost frame; while holding down the CTRL key you will left click on each additional frame located on that imaginary line. After you've selected the last frame you will have multiple frames displaying the resize rectangles at each corner, but they will be blue in color. Right click the mouse to display a pop up menu - this pop up menu will display various options to align multiple frames. The easiest choice now is titled ALIGN TOP; after selecting it from the menu all the frames are now aligned in a more pleasing way (with the top of each frame now aligned horizontally within the report band): So far we have one DETAIL band with eight frames that contain database fields. We'll save the report right now by clicking the floppy disc button located on the toolbar. You can also save the report by clicking FILE from the main menu, then select SAVE. It is a VERY good idea to periodically save your work as you change the report. Now we need to test the report to see how it looks. Click FILE from the main menu, then select EXIT from the pull down menu. You will notice that the Reports Manager screen appears different now: The newly created report file is now displayed onscreen, with the file name / date / time / size information about this report file displayed in the list box. To print the report click the PRINT button; the report will be sent either to the screen (print preview) or to the printer, depending on how the application developer designed the application. For this example the report was generated to the screen; the database only contained 4 database records, so the output was very small: 2005-2014 Scott Daughtry/Oleg Fomin 52 Fomin Report Builder Chances are excellent that the print preview screen will be different than the one displayed above; the above screen capture uses a very simple print preview engine. The important things to notice here is the layout of the information to detect problems with how the report will be sent to the printer. Using the print preview display we can see the following problems: There is too much space between each line of information - this would waste a lot of paper! The street address field is getting chopped off before all the information is printed (ex: 419 Anger Ma) The country field is missing because insufficient space existed for it on the DETAIL band The name fields could be formatted a lot more attractively There is no sorting being done on the database; it would be nice if information is sorted by last name One of the Report Builders most attractive features is it's flexibility - you can change ANYTHING you want to for your reporting needs. The problems identified above with the first report are very easily fixed. We will be fixing these things in the next tutorial step. To recap: on this page you learned: It's a good idea to draw a report on paper first during brainstorming sessions How to add a DETAIL band How to add a FRAME onto the band How to select a database field from the dictionary that is printed from inside a FRAME How to align multiple FRAMES with minimal effort How to print the new report to check for printing problems 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 3.5 53 Basics: Step 4 (Modifying Frame Contents) Now it's time to clean up the report and make it more presentable for yourself and/or your customers! Remember you can move FRAMES with either the keyboard OR the mouse - the choice is yours. For moving a FRAMES in very small increments the keyboard is more precise and easier to accomplish; use the mouse to select multiple FRAMES (hold down the CTRL key, then left click on each desired frame to select them individually), then use the keyboard to move the selected FRAMES (while holding down the CTRL key, use the arrow keys to move the selected frame(s) up/ down/left/right) to where they need to go (yes, you can move multiple objects at one time!). Also note that the TAB key on the keyboard will select the next FRAME for you; shift-tab will select the previous FRAME (just as in other Windows programs that you use). Reopen the report that was just created from the Reports Manager by highlighting it inside the Report Manager screen, then click the CHANGE button. This will display the Report Formatter screen once again, with everything just as we saved it from the previous session. The first thing to change is the default font; some fonts used in Windows are more attractive than others. The Verdana font was designed specifically for readability and makes an excellent choice for reports. You can easily (and quickly) change the font used inside ALL frames in the report by clicking FILE, then select the FONT menu option. You will see a standard Windows font selection window onscreen that allows you to select a desired font, it's style (e.g. BOLD, Italics), and size. Once you select a font and click the OK button you will notice that all of the FRAMES in the DETAIL band will change their font. Be aware that some fonts print larger than other fonts, so if you are tight on space select a font that is narrower than other fonts. For now we'll select Verdana-Regular-8. Located on the Report Formatter toolbar is a button with a blue "A" inside it - this font button will change the font ONLY for the currently selected FRAME (i.e. has the red resizing boxes on the corners). It will NOT change the font used for the entire report! Click the FRAME that contains the LAST NAME field previously selected from the database - we want to make it stand out on the report. After left clicking that frame click the blue "A" button, select Bold, then click OK. The contents of that frame will now be boldfaced - you may need to resize this frame since bold text requires a little more space (because each letter is now a little bit wider). Each FRAME in a report can print in a different font; they can even print in different colors! Try not to use too many different types of fonts in your report, as it can become a distraction and make reading more difficult. Stick with common fonts that are loaded on everyone's machine; otherwise Windows will substitute the font you chose (but isn't installed on another computer) with a font that will cause printing 2005-2014 Scott Daughtry/Oleg Fomin 54 Fomin Report Builder problems (such as a column bleeding into the next column, improper spacing, etc). To recap: on this page you learned: How to change the default font used in a report How to change the font characteristics for a single frame Each frame can be formatted with a different font Choose a font that should be installed on everyone's computer Changing a font/font's properties might require a frame to be widened 3.6 Basics: Step 5 (Resizing The Detail Band) At current, the DETAIL band is wider than it should be, which is adding a lot of blank space underneath each printed line. This is easily fixed, and there are two ways to do it: 1. Resize with Mouse: Left click once on the DETAIL band border line (it should be displayed as a light grey box) to make the resize boxes appear. Select the middle resize box on the bottom of the DETAIL band, and drag it upwards until it is flush with the bottom of the FRAMES. The report builder will not allow you to resize the DETAIL band smaller than required, so you'll only be reduce it's size to a certain point. 2. Right click the DETAIL BAND; from the pop up menu select 'Band Properties'; click the tab titled 'Position' and then make the value for the 'Height' spinbox a smaller value: This method of resizing a Report Band is often easier than resizing with a mouse 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 55 especially if you have frame(s) placed at the bottom of the Report Band (because the Report Formatter will usually shift the mouse's focus to a frame when you try to resize the Report Band if a frame is located near the bottom of that Report Band.) After resizing the Detail Band to the desired height save the report (click the floppy disc on the toolbar), exit the Report Formatter window (FILE -> EXIT), and then test print the report to see how it looks now. Here is what my sample report output now looks like: Notice that the last name is BOLD; the huge amounts of blank space after each line are much smaller now, and the information on each line is aligned horizontally now. But, there is still work to do on this report before calling it a day! To recap: on this page you learned: How to resize a DETAIL band (or any band, for that matter) How to reduce the amount of blank space that is printed below a line Two ways to resize a Detail Band and which one might produce easier results 3.7 Basics: Step 6 (Adding A Page Header) Now we will add a Page Header to the report, which will print the title to our new report and also print column header information at the top of each page. Open the tutorial report to display it within the Report Formatter screen. A Page Header is another type of REPORT BAND that is generated at the top of each page. The report engine keeps track of how much data can be printed on a page; when it's time for the printer to eject the page after printing as much information as it can the Page Header report band is created and printed at the top of the report's page. To add a Page Header, select BAND from the Report Formatter pull down menu, then NEW, then PAGE HEADER. A new empty band named Page Header is inserted ABOVE the DETAIL band. A report's title should be something that anyone reading the report will quickly understand and accurately describes the report's contents. For this report title example the title will be "Customer Database - ACME Sales". Remember that everything with a report that is printed requires a FRAME, so create a new frame inside of the new Page Header band. Add the report title inside of the new empty 2005-2014 Scott Daughtry/Oleg Fomin 56 Fomin Report Builder frame placed inside of the Page Header band. Most reports have a centered, boldfaced title - here is an easy way of ensuring that the report title is always centered on the report's printed page: Place the mouse on the right middle resize box on the empty frame Resize the box until you reach the right side of the report Make sure the gaps are the same for the left and right sides of the frame Type the title inside the FRAME characteristics box Click the center align button on the toolbar Click the blue "A" for font type. Select ARIAL, BOLD, 12, then OK Easy! You now have a title that will always be properly centered, and slightly larger than the rest of the report to make it stand out. You don't have to create your title like this - if you want it left or right aligned, or a different size then feel free to do so! You can also create multiple line titles if you want/need to - the choice is yours! This report will be a columnar-style report, with frames placed within the Detail Band side-by-side that will print database information. This style of report normally has a text heading above each column (to inform the reader what that column of information is). A column's header should only be printed once on each page - if the column header frame(s) are placed inside of the Detail Band they will be printed every time a new database record is retrieved/printed (which is not the desired result) - to print a column header only once per printed page the Page Header Band is the easiest way to achieve this effect. Select the Page Header band. Create a new frame inside the Page Header band directly above the leftmost frame displayed within the Detail Band and then type in the header name (in this case, 'Last Name'). Repeat this process of adding a new Frame and typing a descriptive text title within the new frame for each frame displayed within the Detail Band until each horizontal Detail Band Frame has a Page Header Frame associated with it. After adding all the Page Header frames and their header text you will want to resize their frames to be be the same width as their corresponding Detail Band frame. After completing the frame resize each Page Header/Detail band frame "couple" should be left aligned (to make the report more pleasing and professional looking). To align the frames so they are even: Ctrl-Leftclick each frame to select them all, then right click to display the alignment popup menu. then select Align Top. Now they are horizontally aligned with each other. Go ahead and move the entire line of selected frames until they are roughly 1/4 inch below the report title. Here is what we have so far: 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 57 We can see from the above screen capture that the Page Header band needs to be reduced in height (i.e. too much space between the frame bottoms and the bottom of the Page Header band) - otherwise the printed output will have a huge gap between the column headers and the database information printed in the DETAIL band. Resize the Page Header band (left click-drag the center red resize box until it can't be reduced in height anymore to remove that gap; here is the desired result: Looking pretty good now! However, the column headers would look better if they were BOLD and UNDERLINED, so go ahead and change each FRAME within the Page Header band to achieve this effect. You may need to resize a frame if some of the column's text is cut off when applying the BOLD font attribute. Now we need to left align the column headers with the data information that is printed beneath it. An easy way is to first click the header frame, then Ctrl-Leftclick the field frame underneath it inside the DETAIL band. Once the two frames are selected click the right mouse button, then select "Align Left" from the popup menu. Repeat this process for each column until each Header/Detail pairing is left aligned. Remember that you can move the two selected objects in case they overlap other information by holding down the CTRL key, then tap the left or right arrow button to move the frames horizontally. The final result now looks like this: Once satisfied with the results save your work (click the blue floppy disc) then print a sample report to the print preview to see how it looks: Not bad! There is still room for improvement, but we are well on our way to a nice report. Remember, the Report Builder will print information the way you tell it to YOU control how the reports look, so don't be afraid to experiment. Reports will NEVER change information in your database file(s) - they are completely safe to experiment with. To recap: on this page you learned: 2005-2014 Scott Daughtry/Oleg Fomin 58 Fomin Report Builder How How How How How How 3.8 a Page Header is generated when a report is created to add a Page Header at the top of each page to add a report title at the top of each page to center a Page Header easily to add column headers in a Page Header band to horizontally and vertically align column headers Basics: Step 7 (Sorting Output) Sorting information on a report is crucial for quickly locating information within the report - can you imagine using a city phone book if the names of everyone inside it weren't sorted by last name? The Report Builder allows you to sort information how YOU want it to be sorted. Reopen the tutorial report so it is displayed in the Report Formatter screen once again. The Report Builder engine uses a Sorting Band to sort data the way that you want it to. To add a Sort Band to your report to enable sorting on a database field (in this example, the last name database field) select BAND, then NEW, then SORTING BAND. You'll notice that the cursor changed to a pointed hand. Move the hand until the tip of the finger is on top of the word DETAIL in the detail band, then left click the mouse to add a new Sorting Band to the report. Your report will now look like this: Notice that above the DETAIL band is a new Band entry titled "Sorting Band 1", and a dialogue box titled "Sort Expression" is displayed below it; the Report Builder is asking you how to sort the database information. You will be using the dictionary to select the database field as the primary sort - click the button with the flashlight icon within it to display the dictionary window onscreen: 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 59 This report will be sorted on the Last Name field of the database; expand the "tree" for the "Names Database" to display onscreen all of the database field names for the database. Double left click on the Last Name database field entry to insert the NAM: LastName field name into the entry field for the Sort Expression box: Notice that the database field name is now entered into the entry field; click the SAVE button. The information displayed in the Sorting Band detail is now changed to this: ..to let you know how this Sorting Band will be sorting information when the report is generated. Go ahead and test the sort by saving the report, exit the Report Formatter screen and then print a sample report to the print preview screen. Here is what the report looks like now: Notice that the Last Name field entries are now sorted alphabetically on the printed page. To recap: on this page you learned: You control how database information is sorted on a report The report engine uses the Sorting Band to perform sorting on a database How to create a Sorting Band on a report How to select a database field from the dictionary to sort on 2005-2014 Scott Daughtry/Oleg Fomin 60 3.9 Fomin Report Builder Basics: Step 8 (Functions & Pictures) The Report Builder allows you to manipulate database information in a variety of ways before it is generated to a report's printed page - this capability enables the next "trick" that will be used to make this report even more professional looking! Our tutorial report thus far has three columns (aka: frames) that displays the three components of a customer's name (last name, first name, middle initial) with spaces between each database field. While this is acceptable, we can make it look much better by formatting the database information before it is printed. Instead of printing information inside 3 individual FRAMES we will instead print a formatted name inside of one FRAME. Not only will this look better, but may also take up less space on that line of the report! Here is an example of how the report currently prints a customer's name on the printed page: PRESLEY ELVIS A and here is how we want it to look: PRESLEY, ELVIS A Open the report within the Report Formatter window. Delete the two frames that currently display the First Name and Middle Initial database fields, and also delete the paired frames for those two items displayed in the Page Header report band. Left click the Last Name FRAME within the DETAIL band; the properties box for that frame should look like this: If you will recall, each of the three database fields (Last Name, First Name, Middle Initial) has a lot of blank space after each of their database entries. Report Builder has a way of removing these trailing spaces by using the CLIP () function with each of the database fields - here is how to use it. Open the Last Name frame within the Detail Band and remove the contents of the frame's "Properties" box. Click the button with the flashlight icon to display the Dictionary onscreen. Not only does the DICTIONARY maintain the database field information for this software application but it is also a centralized location for accessing/using the variety of built in functions to manipulate a Frame's contents. Here is screen capture showing where the CLIP() function is located inside of the DICTIONARY window: 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 61 Double left click the CLIP(string) Dictionary entry which will insert it into the FRAME properties window: Obviously we aren't manipulating a database field called (string); this is simply telling you that the CLIP() function is used to manipulate a text string (i.e. you can't use this function on numeric fields). Remove the word "string" from inside the '()' symbols, thus leaving you with = CLIP() inside the contents entry field. Left click once between the '()' characters, then click the DICTIONARY button again to select the Last Name database field from the dictionary. Double click the Last Name database field, which changes the above screen to look like this: What this Properties screen is telling you is that this Frame, at run time, will print the contents of the NAM: Lastname database field after the CLIP() function has processed it. We've solved one piece of the puzzle (how to remove the blank spaces that are stored at the end of a database field's stored content); now we need to combine the last name database field with a comma character and a blank space after the comma. To combine two or more strings together we use the Ampersand (&) character; any text that we want to combine with a database field has to be enclosed in single quotes. So, here is what the Frame Properties screen looks like now: So far so good. We have the last name (with all blank spaces removed), and the comma character added directly after it, with a blank space after the comma. Now it's 2005-2014 Scott Daughtry/Oleg Fomin 62 Fomin Report Builder time to add the First Name database field; however, remember that the first name field can also have blank spaces at the end, so we need to CLIP() that field also. We are combining the First Name field to the existing information, so we also need the Ampersand character to join them together. Go ahead and type in this information: & clip() and then click inside the '()' symbols where the First Name field will be inserted, then click the DICTIONARY button to display the database fields. Here is our revised screen: Now for the last part - adding the Middle Initial database field. This database field is only one position in length, so we don't need to CLIP() that field - we just need to append it to the rest of the information. We do need a blank space after the last name field though. So, go ahead and type in the ampersand (&) symbol at the end of the Contents string, then add a blank space between two quotes, then click on the DICTIONARY button; select the Middle Initial database field to make the Properties Box contents resemble this: Now we need to change the PICTURE for this FRAME; originally it was as long as the Last Name database field allowed, which was 20 places. We want to extend this to be as long as all the fields and blank spaces require for the 3 fields. To see how long the database fields are you can use the DICTIONARY window: You can use the right arrow to scroll the list to the right in case the PICTURE column doesn't display on your screen. The number after the @S is the length of the field; based on the above information we need to extend the frame to 20 + 2 + 20 + 1 + 1 = 44 spaces. It is doubtful that both the last name and first name would fully occupy 20 spaces apiece, so it is up to you if you want to make the picture shorter (which is 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 63 advisable). Click on the tab titled 'Picture'; right now the picture is @S20; go ahead and type in @S34 If you find that some names are being truncated you can increase the length of the picture to accommodate the longer length. Resize the last name FRAME to accommodate the increased picture length; you may need to move some FRAMES to the right to accommodate the extra length of the update name Frame. Don't forget to change the column header, since the Frame below it within the Detail Band now displays a person's full name instead of just their last name. Once you have the FRAMES properly aligned save the report and then run it to see how it looks in the print preview screen. Here is what the sample report looks like now: Much better looking! To recap: on this page you learned: How to remove blank spaces from the end of database field information using the CLIP() function How to format database fields and text information into one frame Where to find the different functions in the dictionary to manipulate database information How and why you need to change the Picture for a frame when combining data How and why you need to resize a frame when combining separate pieces of information 3.10 Basics: Step 9 (Combining Info Inside A Frame) Our sample report is shaping up nicely; how about we clean up the city, state and zipcode information so it prints nicer on the printed page? We've opened up the report so the Report Formatter is onscreen: Notice that the two address lines are being truncated; the city field is also being cut short. To combine the City/State/Zip code information we'll need to eliminate the blank 2005-2014 Scott Daughtry/Oleg Fomin 64 Fomin Report Builder spaces after two of the fields (city and state), insert a comma between the City and State fields, and a blank space before the zip code is printed. This will change the output from: TUCSON AZ 85730 to: TUCSON, AZ 85730 Remember that whenever you combine database fields within a Detail Band that the Header Page column frame(s) need to be updated also! Armed with the tricks presented on Page 8 of this tutorial these changes are easy to achieve. Here is one way to produce the desired results: Resize the DETAIL band to give yourself some room to maneuver in Select the City/State/Zip Code FRAMES together and drag them downward to give yourself room to maneuver within the Band Create a new FRAME where the City/State/Zip Code FRAMES used to be Click the Dictionary button to display all the functions for the Report Builder Select CLIP() from the functions relating to Strings; this will insert '=CLIP(string)' inside the Frame Properties Contents entry field; delete the word 'string' from inside the '()' characters or make the word 'string' highlighted, then click on the Dictionary button again Select the City database field from the Dictionary; the Contents entry field now shows =CLIP(NAM:City) Add a comma character after the CLIPped City field; change the Contents entry field to show: =CLIP(NAM:City) & ', ' & Click the Dictionary button again and select the CLIP() function again then remove the word 'string' from inside the '()' characters. Click on the Dictionary button and select the State database field. Now the Contents entry field shows =CLIP( NAM:city ) & ', ' & CLIP(NAM:state) & We need to add a blank space after the State database field is printed; after the last Ampersand (&) character add a single space surrounded by quote characters: ' ' Click on the Dictionary button and select the ZipCode database field. This completes the act of combining the City/State/Zipcode information into one frame. The FRAME contents look like this: 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 65 Now we need to change the Picture to accommodate the combined length of the three database fields plus the comma and space characters between the fields. If you don't know the length of the fields you can click on the Dictionary button to retrieve their lengths. For this example we have 30+2+2+1_10 = 45; chances are high that the length will be MUCH shorter than this, so it is up to you if you want to shorten this up to save space on the printed page. Click the Picture tab on the FRAME properties box. Right now the picture entry field is completely blank: Click on the button with the "face" icon to display the Picture Wizard. A pop up window of picture types is shown onscreen: The FRAME that we created for the 3 combined database fields contains String values, so choose the String radio button and click NEXT. You are prompted for the maximum length of this string: The default starting value for a String is 20 positions; change this to 45 and then click OK. Now the Picture entry field in the Frame Properties box looks like this: You will also notice that the FRAME contents in the DETAIL band have changed to 2005-2014 Scott Daughtry/Oleg Fomin 66 Fomin Report Builder dollar ($) signs. Resize the new FRAME to the correct length, then align it to be lined up horizontally with the other FRAMES in the DETAIL band (i.e. Align Top). Within the Page Header band delete the Frames previously used as column headers for the Zip Code and State columns (right click the desired FRAME, then select DELETE from the pop up menu to remove that header FRAME). Now we have one header FRAME left for "City"; we can modify that Header to reflect a more fitting description (City / State / Zip Code). We'll need to resize that header FRAME after changing the text, then left align it with the associated FRAME in the DETAIL band so everything lines up. Delete the original City/State/Zip Code FRAMES that we moved downward inside the DETAIL band since they are no longer needed. We'll also move the new FRAMES for the combined City/State/Zip Code database fields as far to the right as possible - we need to free up space for the Address lines that are being chopped off. While we're at it, we can add back in the Country field that we originally didn't have room for. We'll make the DETAIL band print 2 lines for each database entry. Here is what the final DETAIL band looks like: Save the changes and then print a sample report to the Print Preview screen to see how everything looks: Quite a visual difference! To recap, on this page you learned: How to avoid truncating information when a FRAME is too small How to combine separate database fields into one FRAME How and why you need to change the PICTURE for a FRAME when combining text & data How to use the Picture Wizard dialogue box to change a FRAME Picture to print longer text strings That a detail band can contain multiple lines for the same database record to make it more visually appealing 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 3.11 67 Basics: Step 10 (Multiple Sorting Levels) Now that our sample report is looking pretty good let's explore some tricks that you can use for your reports. A common reporting requirement is having multiple layers of sorted information. In this module we are going to change the report from printing in Last Name sequence to printing a report sorted first on the State, then the City, and then the Last Name database fields. Back on PAGE 7 of the tutorial we sorted the report on the Last Name field of the report by creating a Sorting Band. We will still use a Sorting Band to perform the sorting - we'll just be using more of them to perform the layered sorting that we need for the report! It is important to figure out the correct sequence of events BEFORE you start adding Report Sorting bands to your report. Take a good look at your database information and plan on paper how you want the report to be sorted. This will save you time in the long run and prevent frustration later on. For the example above we want the report sorted on three different database fields. The most important sort is on the STATE database field; within the STATE information we want it to be sorted by the CITY. Within the CITY we want the names sorted alphabetically by the LAST NAME. The first order of business for this tutorial example is first deleting the existing Sorting Band previously created in the sample report. To delete a Sorting Band you place the mouse cursor directly over the words Sorting Band, then click the right mouse button. From the pop up menu select 'Delete Band' - the sorting Band is now gone and the report is unsorted for the moment. NOTE NOTE NOTE If you are modifying your report that already has a Sorting Band created, and have also created associated Header and Footer bands for this Sorting Band you DO NOT want to delete the band! If you want to change the existing sort for a Sorting Band you only need to right click once on that Sorting Band, select PROPERTIES from the popup menu, then modify the field to sort by! NOTE NOTE NOTE We will be adding Sorting Bands in the same sequence as their order of importance the primary sort on the STATE database field is first, then CITY, then LASTNAME. From the Report Formatter menu select BAND, then NEW, and then SORTING BAND. The mouse cursor changes to the hand cursor; place it inside the DETAIL band and left click the mouse. Inside the Sort Expression box you click the Dictionary button, then select the STATE database field from the Dictionary, then click SAVE. Repeat the above steps two more times for the CITY and then the LAST NAME 2005-2014 Scott Daughtry/Oleg Fomin 68 Fomin Report Builder database fields, adding a Sorting Band for each field. The final result will look like this: You can continue adding more Sorting Bands if you need to; for example, if you wanted the names to be sorted by Last Name, then the First Name you could add a fourth Sorting Band with the database field NAM:firstname selected. Once you are done adding Sorting Bands save the report and then print a sample report to the print preview screen to see if the output is what you expected: Looking at the information above we see four names of people living in FL; within those 4 names it is sorted alphabetically by the City, and within the 2 people living in Oakland, Fl the last names are sorted alphabetically. Perfect! It may take some trial and error to get the information sorted exactly as you want it to print. Remember that you can cause no damage to the database file(s) using the Report Builder, so experiment as much as you want. An important point to remember about multiple sorts - they will slow down the report generation, as more work has to be done by the database engine and your computer to sort the data as you want it to appear within the report. If you have fairly small database file(s) you won't experience much (if any) of a delay; on large database file (s) you will need some patience for the report to be created. To recap, on this page you learned: How to add additional Sorting Bands within a report to "nest" information through multiple sort levels How to delete a Sorting Band The performance impact of multiple Sorting Bands in a report 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 3.12 69 Basics: Step 11 (Filters) Depending on how the developer designed this software application, a Query Wizard might be employed as a simple means to build/reuse a FILTER that will limit what database record(s) are sent to the report (e.g. print only customers living in Florida; print only part numbers that were sold between January and June). If a Query Wizard module is displayed before the report is generated then use it (as it is simpler, and the filters that you build using that module can also be used in the application's browse screens). If a Query Wizard module is not included in this software application you can still create/use a FILTER within a Report Builder report! A database FILTER is a means of extracting only a portion of information that you want (and either display that filtered information onscreen or within the printed report). For example, if you only want to know the names of people living in France in your address book why would you print a list with EVERYONE's names? The list could be huge, and take forever to read through and extract only the information you want. A database FILTER can be very simple (ex: Color = 'blue'), or complex (ex: Race = 'Caucasion' AND Income > 25000 AND (Status = 'Single' OR Status = 'Divorced') - it depends on what the filter situation requires. A FILTER is saved inside of the Report Builder report, so you don't need to create it each time that you want to print the report. There are some basic concepts that you need to understand before creating a filter; some knowledge of the Report Builder functions will prove handy for creating your report filters. A simple definition of a FILTER could be described as comparing database information against something else. Some simple filter conditions: STATE = 'Ca' PRICE > $300 AGE < 30 As shown above there are 3 parts to a filter: The database field starts the filter An operator symbol that describes what is being done with the database field A text string or number that the database field is being compared against You can retrieve the database field name and different operators of the filter condition from the Dictionary. The third part of the filter is up to you to decide - remember that if you are comparing database information against textual information you need to make it a string (enclosed in single quote symbols); if comparing database information 2005-2014 Scott Daughtry/Oleg Fomin 70 Fomin Report Builder against a number then quote symbols are not used. Report FILTERS are created by selecting FILE from the pull down menu; select REPORT PROPERTIES from the menu to display the Report Properties screen: On the bottom of the Report Properties window is an entry field titled Record Filter; to the right of the entry field is the now-familiar Dictionary button (flashlight icon). The record filter is typed/constructed in this entry field, and once the SAVE button is clicked the FILTER is embedded with the report (NOTE: Don't forget to SAVE the report after building/changing a filter!). Until you learn the different functions and operators that are built into the Report Builder you should use the Dictionary with creating a report filter (which is fine - I still use it too!). Let's start with creating a simple filter to show how to use the Dictionary to help build the filter condition: With your report open, and the Report Properties window visible (as shown in the above screen capture) click on the Dictionary button to display the list of database fields. Select the STATE field in the dictionary to insert it into the Filter data entry field above. This completes step one of the filter building process. We now need to decide how we are going to compare the State field in the database. For this example we want to print out database entries for only those people living in Florida. To compare information we use an OPERATOR symbol which tells the computer how to manipulate information. After inserting a blank space after the field name we click on the Dictionary button again and then choose the entry titled "Equal To" from the list of Standard Operators. This action inserts an equal sign (=) after the field name, which completes step 2 of the filter. Now we have to manually type in how we are going to compare the State database field. We wanted to print only those entries for Florida; the state database field is 2 positions in length. We will be comparing "FL" against the database field. Add a blank space after the '=' operator and type in (using single quote characters, because this is a text value): 'FL' Here is what the completed filter appears in the Report Properties screen: 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 71 In theory this filter is 100% correct; structurally it IS correct, but there exists a problem that could result in the report's contents not being 100% accurate. The problem is how the State database field is stored in the database - when someone inputs the State information it is capitalized as "Fl", with the "l" being lowercase. The filter shown above (section 3 of the filter condition) is all uppercase 'FL'. Because computers do EXACTLY what YOU tell them to do, the result will be that NO database entries will be found, even though there are 4 entries in this database that have people living in Florida! Before throwing your hands in the air, take a minute to compose yourself while we dig a little deeper into how filters work. The filter statement shown above is structurally correct: we have a database field, an operator, and the text string for what it is being compared against. The problem is that we are telling the computer to make sure that the State field EXACTLY matches the text string "FL". Computers are stupid - they don't understand that it should have checked for "Fl" instead. WE have to tell it to do that! There are several ways to fix this problem; the easiest way of ensuring that a filter condition dealing with text strings will always work is to use either the lower() or upper () function to convert the contents of a database field to a 100% consistent output (either 'fl' or 'FL'). Armed with this knowledge we change the filter to look like this: Now we can click the SAVE button, then run the report to see how the information looks: 2005-2014 Scott Daughtry/Oleg Fomin 72 Fomin Report Builder Perfect - all four people living in Florida now appear in the report! As mentioned before there is another way of changing the report filter to make sure that the data printed is correct. We would change the filter to perform two comparisons of the State database field against "FL" AND "Fl". You would piece together two different filters by using a CONDITIONAL OPERATOR out of the Report Builders dictionary. Here is what the revised filter would look like: A little more work, but it achieves the same result as using the lower() and upper() function calls. You may be asking yourself why even bother checking for database entries where the State database field is "FL", since the database program is supposedly capitalizing the information as the person types it in. The reason is simple - Murphy's law! Never take for granted that information typed in by someone else is how you would type it in. To recap, on this page you learned: What a filter is, and why one would be used How a filter is structured (what 3 components make up a filter) How to use the Report Builder features to easily create a simple filter How to create a filter that will work 100% of the time without worrying how the data is stored inside of a database field (lowercase, uppercase, proper case) 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 3.13 73 Basics: Step 12 (Filters Continued) The previous tutorial page got your feet wet on creating a filter; here we are going to dig a bit deeper in creating some more filters. As mentioned before, you can use the Dictionary (or this help file) to see what the different Report Builder functions and operators are that can be used in a report filter. Some functions will be used more often than others; here is a short list of the most popular ones: Clip() - remove blank space from the end of text Instring() - check for text inside a larger piece of text Lower() - convert text to all lowercase Sub() - retrieve a portion of a text string for comparison Upper() - convert text to all uppercase For example, let's say a report of only those customers having a last name that starts with the letter "F" needs to be printed. You would use the sub() function to test the value of the first letter of the last name; to be safe you would also use the upper() function to make sure that letter was uppercase. Here is what that filter would look like: UPPER(SUB( NAM:state ,1,1 ) ) = 'F' Notice that we used two functions at the same time, one inside the other, with the database field in the middle. Here's another good example; within the NOTES memo field of the database you want to find/print those database records that contain the word 'SONY'. Remember that you can't assume that people typed in SONY in capital letters; they may have spelled it Sony or sony (or any other possible variation), so we have to convert the memo field first to UPPER case, then check for the word SONY. Here is what the filter would look like: INSTRING( 'SONY', UPPER( NAM:Notes ) ) Again, we are using a function inside a function (the function UPPER() inside of the function INSTRING()). To recap, on this page you learned: A filter condition can contain multiple function calls - it all depends on what the resulting report needs to extract from the database to make the report accurate. To recap, in this tutorial lesson you learned: How to create increasingly complex filters by using multiple function calls The existence of the instring() and sub() functions 2005-2014 Scott Daughtry/Oleg Fomin 74 3.14 Fomin Report Builder Basics: Step 13 (Adding Graphics) A common reporting need is to include a company/agency logo in the Report Header band for a letterhead document or corporate branding. An image is also a nice way of sprucing up otherwise dull reports into a more eye-catching design. The Report Builder makes it very easy to add graphic image file(s) to your report. Image files are normally placed in the Report Header band, but you can placed in other Report Bands as needed (e.g. Page Header, which will print the image on every printed page of the report). After opening the report into the Report Formatter screen create a new frame in the desired location within the Report Header band. Right click on the new frame to display it's Frame Properties window. Underneath the Contents entry field is a checkbox titled 'Contents - image file name'. Go ahead and check this check box, then click the Dictionary button (the icon that looks like a flashlight): Because the 'Contents - image file name' is checked the Dictionary button now operates like a standard windows file selection box instead of displaying the Report Formatter Dictionary. From the pop up file selection box you can choose the desired graphic image file from one of these file formats: o *.Bmp o *.Gif o *.Jpg o *.Pcx o *.Wmf Some image file formats lend themselves better to resizing (larger or smaller) than others; if possible stick with .Wmf (Windows Meta Files), as they seem to resize with the best image quality. After selecting the image file it's file name will be displayed inside the new frame [NOTE: the image will NOT be displayed inside of the frame/ report band]: 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 75 Save the report and then run it to see the result: Remember that you can use the alignment buttons to define how the image will be displayed inside of the frame (top / middle / bottom aligned). You can also choose to place a visible frame around the image file (on one or more sides) and optionally change the fill coloring used in the frame. To recap, on this page you learned: That you can use image file(s) in your report How to select an image file to print inside of a frame That you can draw a frame around the image file (because it is stored inside of a frame) 3.15 Basics: Step 14 (Records Printed Counter) Knowing how many database records have been selected for printing can be a useful addition to some report styles. The Report Builder makes it very easy to add this information to a report; go ahead and open the tutorial report that you've been using thus far and then: Create a Report Footer band (from the main menu select BAND, then NEW, then REPORT FOOTER). An empty Report Footer band is now displayed within the Report Formatter screen. Create an empty frame in the new Report Footer band in the desired location; with the new frame selected click the Dictionary button on the Frame Properties box.. From the Dictionary pop up tree menu select the node titled 'OTHERS'; under this entry expand the node titled "Built In Variables" and then select "Record Counter". This will insert this information into the Frame Contents: =Record_Counter That's it! You can also manually type in the (=Record_Counter) information without having to go through the Dictionary. You may choose to make this information print a little fancier by adding text to the left of the Record Counter by replacing the '=Record_Counter' value with: ='Records Selected: ' & left(Record_Counter) 2005-2014 Scott Daughtry/Oleg Fomin 76 Fomin Report Builder To recap, in this tutorial section you learned How to print a counter of matching database record(s) for a group of related information 3.16 Basics: Step 15 (Page Breaks) Often times a report needs to eject a page whenever a database field value changes; for example, a school teacher wants to print a list of students for each of their six classes - when the CLASS NUMBER field changes from first period, then second period, then third period (and so on) a forced page break would make sure that each student roster is printed on a separate piece of paper (so the students can sign into class before the bell rings on a unique printed roster). The Report Builder has several ways of forcing a page break, and the page break feature centers on the Sorting Band and how you configure that sorting band's options to determine how the page break is carried out. Using the above classroom report example, you want to create a report that performs a page break whenever the Class Number changes value within the Class database; the first Sorting Band will use the Class Number database field. Printed class sign-in rosters always have student names sorted alphabetically by the student's last name, so the second Sorting Band will use the Last Name database field to perform the second level sort. Here is what the printed page will look like, with comments added to the right of the printed page that shows how each section of the report relates to a different Report Writer band type: A combination of static text and two databases (CLASS and STUDENT) that are linked together (one class can have multiple students) are printed on the report. As shown above, the report uses seven different bands to create the printed student sign-in roster: 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 77 Page Header - static text that is printed at the top of each report page Sorting Band 1 - uses the COURSE SEQUENCE NUMBER field - when that value changes (14-01-01 to 14-01-02) the page break is desired Group Header 1 - contains the COURSE SEQUENCE NUMBER field that will force the page break when that database field's value changes and static text Sorting Band 2 - uses the LAST NAME field to sort the student's names alphabetically in ascending (A-Z) sequence Detail - nothing is placed inside of this report band, but it does play an important role to cycle through the databases (explained below) Group Footer 2 - prints the student's FIRST NAME and LAST NAME database fields, along with other database fields Group Footer 1 - prints database field values from the COURSE database that should only print one time on the printed page Page Footer - prints the page of pages value in the bottom right corner of each page Here is how the above report is displayed inside of the Report Builder: The report bands properties are configured as such: Page Header - default values Sorting Band 1 - contains the COU:SeqNbr database field (aka: Class Number) Group Header 1 - default values EXCEPT for one important setting: 2005-2014 Scott Daughtry/Oleg Fomin 78 Fomin Report Builder This checkbox is required to force the page break after the COU:SeqNbr value changes Sorting Band 2 - Stu:lname database field Detail - default values EXCEPT for one important setting: 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 79 A Detail band is required for the Sorting Band(s) to be added to the report; for this report, no data is being printed within the detail, so a value of zero is entered in the 'Print section, if expression evaluates TRUE' entry field knowing that it will never happen - the result is that the COURSE database is forced to be cycled through, from the first database record to the last, which 'pulls' in all of the information that needs to be printed on the report. Group Footer 2 - Default settings: Group Footer 1 - Default settings except for one setting change: 2005-2014 Scott Daughtry/Oleg Fomin 80 Fomin Report Builder For this particular report design, the Instructor information looked better at the bottom of the printed page, so the checkbox for 'At the bottom of page' is clicked to force it to be printed at the page bottom. This isn't a mandatory setting to use, but a cool option to know of for other reports that you design for your particular reporting needs! Page Footer - default settings: 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 81 To recap, on this page you learned: How to force a page break when database field information changes for the current database sort How to make sure information is always printed at the bottom of the report page How to 'skip' printing any information in a Detail band by creating a fake logical condition that will never happen to force every database record to be evaluated 3.17 Basics: Step 16 (Using Total Fields) A common requirement of some reports (especially financial reports) is printing total fields (such as total sales) or the number of matching database entries for a group of information. This information is normally placed within a Group Footer report band, so it prints at the end of that related group of database information. For this example let's assume that we want to print the total number of database record(s) for each state. This information will print at the last page of that group of information as a summary; here's how create this effect: Create a Sorting Band on the STATE database field (if one doesn't already exist) Create a Group Footer report band (if one doesn't already exist) on the STATE database field Add a new frame inside the new Group Footer report band Click on the Dictionary button for the new Frame Underneath the 'User Variables' section of the dictionary will be an entry labeled 'Gather Totals'. Each of the Group Header / Group Footer report bands that you have defined will have an entry here titled 'Group Totals'. Highlight the entry for the STATE database field: 2005-2014 Scott Daughtry/Oleg Fomin 82 Fomin Report Builder Click the '+' button at the top of the Dictionary dialogue window A new dialogue box appears to create a new variable based on the selected database field: As displayed above, there are many different ways of manipulating the information to be stored in the new variable. Here is a breakdown of each item: Assign Name: Enter the desired name of the variable here. This name MUST be unique; do NOT use the same name as the database field! An easy way of keeping the name unique is by using a prefix, such as LOC (which signifies 'Local'); for example, for the database field NAM:STATE a good variable name would be LOC: STATE Field/expression to total: Use the Dictionary button to help select the database field(s) that you want to manipulate here. Picture: Define how the variable will be printed on your report by using the Picture Wizard. Total Type: Define how the selected database field(s) will be manipulated. From the drop list you can select o Sum o Average o Count o Minimum o Maximum o Evaluate Evaluate On: Define when the variable will be modified; from the drop list you can 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 83 select o At Each Record Retrieve o At The End Of The Group o At The End Of The Report' o At The End Of Every Page Here is the dialogue box already filled out to build the new variable: Here is how the dictionary appears after adding the new variable: And here is the modified Group Footer report band to make use of the new variable information: And an example of what the report output will look like: 2005-2014 Scott Daughtry/Oleg Fomin 84 Fomin Report Builder To recap: on this tutorial page you learned: How to create a variable to be used within a Group Header / Group Footer band How to manipulate the characteristics of this new variable (e.g. it's appearance, how information is gathered from the database, etc) How to combine the Group Header / Group Footer variable with text for printing meaningful information in a report band How to display a counter within a report band for the number of database records that are printed while using a filter condition 3.18 Basics: Step 17 (Using Group Total Fields) Printing dollar totals for a group of database information is very common in financial reports (i.e. What are the total dollar sales for all customers in a state?). The concepts described in the previous tutorial page are practically the same to satisfy this requirement, with some slight changes to achieve the desired result: Create the Sorting Band on the desired database field to perform the calculation against (in this case, the STATE database field is used because we need to add the total sales based upon a state) Create a Group Footer band on this same database field Create a new frame inside the Group Footer band Click the Dictionary button for this newly added Frame Click the '+' button at the top of the Dictionary dialogue box Create a new variable to contain the dollar total value based on the database field containing the dollar sales (for this example it is the database field NAM:Sales): 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 85 NOTE NOTE NOTE Remember that the variable LOC:StateTotal will contain the SUM of the NAM:Sales database field! This means that the variable will most likely be larger (potentially MUCH larger) than the largest database entry; when assigning the Picture for the variable MAKE SURE you increase it's length to accommodate this situation otherwise your data contained in the variable may be incorrect due to truncation! NOTE NOTE NOTE After saving the new variable the Dictionary screen will be updated to reflect that addition: And here is the Report Formatter screen after adding the variable to the report band (and formatting some text for that variable to make it print nicely): 2005-2014 Scott Daughtry/Oleg Fomin 86 Fomin Report Builder And some sample output: Naturally the database field for sales for each customer could be added to the Detail report band; one could also change the Picture for the "Total Sales" to include a leading dollar sign symbol. In fact, let's also add some lines to this report band to really spruce it up: As shown above, the Sales information for each database record was added. Also added were a top border for the first frame (Total Records For The State) and a bottom border for the second frame (Total Sales For The State) located inside the Group Footer report band. To recap: on this tutorial page you learned: How to create a Group Total variable within a Group Header / Group Footer report band 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 87 How to use this variable style to store numeric information (such as sales information) How to combine this variable with text to print attractive and meaningful report information 3.19 Basics: Step 18 (Using Grand Total Fields) The topics covered in pages 16 and 17 in the Tutorial help topics can also be used to print a Grand Total value on the last page of a report: Add a new Report Footer band to the report (click on BAND, then NEW, then Report Footer) Create a new frame inside this new report band; click on the Dictionary button Inside the Dictionary dialogue window left click the Grand Totals item; this is located under the Gather Totals section of the User Variables section. Click the '+' button to add a new variable Assign a UNIQUE name for this new variable; select the database field containing the dollar amount that you want added together. Change the picture length to a longer length than what the selected database field is already set to, and add the '$' character to the string. The "Total Type" will be "Sum", and it will be evaluated 'At each record retrieve': After clicking the save button the dictionary screen is updated: 2005-2014 Scott Daughtry/Oleg Fomin 88 Fomin Report Builder Some sample output using the new Grand Total field on a report page: If you wanted to put forth the effort, you could define variables for each of the possible states that the database can have (50 states), then modify the Report Footer detail band to print a state by state breakout of sales. To perform this neat trick you would: Create a variable in the Dictionary for all 50 state abbreviation codes in the Grand Totals section of the dictionary. The variable would make use of 3 internal functions of the Report Builder: Clip(), Upper() and Choose(). The first two functions are used to convert the State database field into a consistent format for testing with the Choose() function. The Choose() function is used to compare the current database record against the known state abbreviation code; if it matches the database field containing the total sales for this customer living in the state is added to the variable (to keep a running total); otherwise it is skipped. In the Report Footer report band a new frame is added. The Dictionary button is clicked with the empty frame being highlighted. Under the Grand Totals section of the User Variables a new variable is created by clicking the '+' button. For this sample report a new variable is being created for state abbreviation code "FL" (all customers living in Florida). Here is what the variable information looks like: 2005-2014 Scott Daughtry/Oleg Fomin Basics You Need To Know (aka: The Tutorial)! 89 The Save button is clicked, which inserts the new variable into the selected frame: Another trick being used is using the Center attribute for the frame contents for both the text string "Florida" and the Loc:Florida variable. By using the border attributes a table effect is achieved, which makes the summary page look very attractive. The pattern of adding a new frame for the state abbreviation code, and another frame for a new variable for that state abbreviation code is repeated. You can elect to stack them any way you desire; the choice is yours! Here is how the report band looks at the end: As shown above, 4 different states are being tracked, with the total dollar sales printed below. Here is the sample output: 2005-2014 Scott Daughtry/Oleg Fomin 90 Fomin Report Builder To recap: on this tutorial page you learned: How to use a Grand Total variable field on a report page How to use multiple Grand Total variable fields on a report page How to use frame borders to create attractive report output 2005-2014 Scott Daughtry/Oleg Fomin 91 4 Fomin Report Builder "How To" Section The hyperlinks below provide answers to common reporting situations: Frame Tricks Change default frame settings (border, fill color, etc) Combine text and database field information onto a report page Conditionally print information onto a report page Date fields are printing five numbers - help! Prevent truncation of a MEMO field during printing Draw A Box Around A Frame Header/Footer Tricks Add page number counter to the report page Add current date/time to the report page Different header on page one than remaining report pages Same footer text is printed until last report page is reached Miscellaneous Topics Save a Report Report Variations Labels Mail merge formletters Sorting Tricks Multiple sort levels Sorting in descending sequence User-Defined Variables Creating/saving user defined variables 4.1 Frame Tricks 1. Default Frame Settings 2. Combine text + database field content 3. Conditionally print text 4. Date field manipulation 5. Prevent memo field truncation on the printed page 6. How To: Change a Frame's Border/Fill Properties 2005-2014 Scott Daughtry/Oleg Fomin "How To" Section 4.1.1 92 How To: Modify Default Frame Settings Problem: Removing the border from every frame you add is becoming tedious. Solution: You can modify the default settings for newly added frames very easily: Open up a report (any saved file, or create a new file) Select the menu item titled OPTIONS Select the menu item tited DEFAULT FRAME The FRAME PROPERTIES window will now appear onscreen: By default the checkboxes for LEFT/RIGHT/TOP/BOTTOM will be check marked (screen capture above shows only two of them are checked... this is from a different example in this help file). Uncheck all of the desired Border check boxes (left, right, top, bottom) to suit your needs and click the SAVE button. The next time you add a frame to a report it will inherit the default frame border properties that you have defined above! 4.1.2 How To: Combine Text And Database Fields Problem: Your report page needs to combine freeform text and database field information on the same line. Solution: After adding a new frame to the report page double left click the frame to display the Frame Properties window. Inside the Contents entry field you can add the text that you want to display, a blank space after that text, an Ampersand (&) character, another blank space, and then the desired database field. Example 1 Combine the text "Vendor Name:" and the contents of the database field named INV: Vendor. The Frame Properties Window entry field would resemble this: 'Vendor Name: ' & INV:Vendor 2005-2014 Scott Daughtry/Oleg Fomin 93 Fomin Report Builder Example 2 Combine the text 'Vendor Name:' and the contents of two database fields (INV: Lastname, INV:FirstName) that contain the first and last name of the vendor. You want the output to be formatted as the last name and then the first name, separated by a comma symbol. You also want to make sure that the database fields don't print extra blank spaces to avoid the output from looking odd (ex: Washington , George). The Frame Properties Window entry field would resemble this: 'Vendor Name: ' & clip(INV:LastName) & ', ' & CLIP(INV:FirstName) 4.1.3 How To: Conditionally Print Text Problem: Some of the information inside the database, when printed, is empty due to the way it was inputted by the user. When the report is printed this results in blank spaces on the report where the information would/should have been printed. For example, the fictional database program has a database field defined for the customer's phone number - the customer either didn't have a telephone, didn't provide the information to your sales clerk, or your sales clerk forgot to type it into the application. Solution: By using the CHOOSE() logical operator you can test for a condition and tell the Report Builder how to handle the result. Example 1 For the above problem (empty telephone number) you need to check the length of the database field; if it is less than seven characters in length then you know the telephone number is bad or empty. To check the length of a database field you need the CLIP() and LEN() functions; CLIP() is used to remove any blank spaces from the end of the database field value, and LEN() will return the exact number of characters that contain an alphanumeric value (A-Z, 0-9). The Frame Properties Window entry field would resemble this: =CHOOSE( LEN(CLIP(INV:PhoneNumber)) < 7, 'Unknown', INV:PhoneNumber) Example 2 If the database field named INV:VendorNumber contains a zero you want the text "unknown" printed on the report page instead of the number zero; if the INV: VendorNumber contained a value higher than zero you want to print the Vendor's Name. The Frame Properties Window entry field would resemble this: ='TOTAL for vendor ' & CHOOSE(INV:VendorNumber=0,'unknown',VEN: VendorName) 2005-2014 Scott Daughtry/Oleg Fomin "How To" Section 4.1.4 94 How To: Date Fields If your date fields are printing something like this on your report: 92716 there is no need for panic. Your database application is storing date field information as a five digit number to avoid the dreaded Y2K problem that occurred in 2000 (i.e. date fields were stored as a two digit year - when it became 2000 the database didn't know if it was 1900 or 2000). This is an easy problem to fix by using the FORMAT() function and the appropriate Picture! Let's assume that you have a database field named "CUS:BDATE", and it stores the customer's birthday. When you print this database field onto a report page it prints using the 5 digit number. The FORMAT() function is passed the database field that needs manipulated (CUS:BDATE) and the type of Picture that you desire to change it's output: Desired Output Format mm/dd/yy mm/dd/yyyy mm dd, yyyy mmmmmmmmm dd, yyyy dd/mm/yy dd/mm/yyyy dd mmm yy dd mmm yyyy yy/mm/dd yyyy/mm/dd yymmdd yyyymmdd mm/yy mm/yyyy yy/mm yyyy/mm Picture To Use @D1 @D2 @D3 @D4 @D5 @D6 @D7 @D8 @D9 @D10 @D11 @D12 @D13 @D14 @D15 @D16 Example format(CUS:BDATE, format(CUS:BDATE, format(CUS:BDATE, format(CUS:BDATE, format(CUS:BDATE, format(CUS:BDATE, format(CUS:BDATE, format(CUS:BDATE, format(CUS:BDATE, format(CUS:BDATE, format(CUS:BDATE, format(CUS:BDATE, format(CUS:BDATE, format(CUS:BDATE, format(CUS:BDATE, format(CUS:BDATE, @D1) @D2) @D3) @D4) @D5) @D6) @D7) @D8) @D9) @D10) @D11) @D12) @D13) @D14) @D15) @D16) The first nine examples above (@D1-@D9) will NOT print a leading zero if the day of the month is 1-9, or when the month number is 1-9; for example, if the date is 1 Jan 2000 and the @D1 picture is used the output would be 1/1/00. To change the output to 01/01/00 you would change the format string to this: format(CUS:BDATE, @D01) 2005-2014 Scott Daughtry/Oleg Fomin 95 Fomin Report Builder You would do likewise for the @D2-@D9 pictures (making them @D02, @D03, etc). 4.1.5 How To: Prevent MEMO Field Truncation Problem: When a MEMO field is printed it is only partially printed... Solution: Double left click the MEMO field frame in the report. In the Frame Properties Window change the default picture (which may show up as @S255) to nothing - the entry field should be BLANK. This will now print the entire contents of the MEMO field onto the report. 4.1.6 How To: Change a Frame's Border/Fill Properties Whenever a frame is added into a Band (regardless of the Band type), a box is automatically added around the frame (as shown above). In the toolbar area (highlighted, top row) are four buttons that toggle that Frame "side" either on or off. By manipulating these frame border "toggles", combined with the option to 'fill' a frame with a color, you can create some interesting effects. For example, you can place frames side by side within a band (e.g. Page Header Band), untoggle the top/left/right frame sides for each of those frames to create an underlined effect to the text: Using this method when a straight horizontal line is desired that runs the full width of a Band is far easier than using the UNDERLINE EFFECT for that text Frame! You can use the FILL feature of a Frame to create an interesting design effect; usually the frame would have all four Frame borders toggled back to True status again (i.e. the default Frame side value): 2005-2014 Scott Daughtry/Oleg Fomin "How To" Section 96 Select the first Frame and then click the FILL button in the toolbar ; a popup window will appear onscreen to select the desired color to fill that Frame with: Select the desired color and click the OK button to fill the Frame with that desired color; repeat for each of the Frames until completed (NOTE: You cannot select multiple Frames and change their fill color at the same time - you must change each frame individually). Here is an example of a Page Header band with each frame filled with dark gray, and then the text contents of the Frame changed from black colored to white colored text: 2005-2014 Scott Daughtry/Oleg Fomin 97 4.2 Fomin Report Builder Header/Footer Tricks 1. Add the current date / time to a report page 2. Add a page number counter 3. Different page footers 4. Different page headers 4.2.1 How To: Add Date & Time To Report Page The majority of reports that you create will require the date (and possibly time) the report was generated to be printed on a report page. Here is how to do it: Add the report band that will contain the date/time information. Typically, the top left of the Page Header will display the date/time the report was generated. Add a new frame onto the report band referenced in the previous step. Double left click the newly added frame to display the properties for that frame and type this information into it: =FORMAT(TODAY(),@D17) &' '& FORMAT(CLOCK(),@T01) Optionally remove the borders from the newly added frame (top/left/bottom/right) Your report page will now print the text dd/mm/yyyy hh:mm onto the top left of the report page. You can use different pictures to format the current date or time to suit the report's needs. 4.2.2 How To: Add Page Number Counter Most reports will display a page number counter printed within the Page Footer; here is how to do it: Add the Page Footer band. Add a new frame onto the Page Footer band. Double left click the newly added frame to display the properties for that frame and type this information into it: ='Page '& Page_Counter &' of '& Total_Of_Pages 2005-2014 Scott Daughtry/Oleg Fomin "How To" Section 98 Optionally remove the borders from the newly added frame (top/left/bottom/right) Your report page will now print the text Page n of nn onto the bottom right of the report page (n representing the current page number, as grabbed by the PAGE COUNTER variable; the nn represents the total number of pages in the report, as grabbed by the TOTAL_OF_PAGES variable) 4.2.3 How To: Different Page Footers Sometimes a report will need a different report page footer on page one than on the rest of the report pages. This is very easy to do: Add a REPORT FOOTER band to the report. Inside the newly added Report Footer report band add a frame; inside the frame you'll add the text to be printed only on the final report page ONLY inside the Frame Properties window. Add a PAGE FOOTER report band to the report. Double left click on the newly added Page Footer report band to display it's Band Properties dialogue box; you'll insert the following text inside the 'Print section, if expression evaluates TRUE' entry field: NOT LastPage The Band Properties dialogue box will look like this: Click SAVE, and then save the report. When the report is generated anything you've placed inside the Page Footer report band will be printed on all pages UNTIL the last report page is reached - at that point, whatever you've placed inside the Report Footer report band will be printed on the final report page instead of the Page Footer band contents! 4.2.4 How To: Different Page Headers Sometimes a report will require a different report page header on page one than on the rest of the report page headers. This is very easy to do: 2005-2014 Scott Daughtry/Oleg Fomin 99 Fomin Report Builder Add a REPORT HEADER report band to the report Inside the newly added Report Header report band add a frame; inside the frame add the text that will be printed only on page one inside the Frame Properties window Add a PAGE HEADER report band to the report Double left click on the newly added Page Header report band to display it's Band Properties dialogue box; insert the following text inside the 'Print section, if expression evaluates TRUE' entry field: Page_Counter > 1 When the report is generating it will print the Page Header report band ONLY after page one has printed. You can place anything you wish inside the Page Header report band that is needed (text, database fields, etc) to meet the report's output needs. 4.3 Report Variations 1. Create / print labels 2. Create a mail merge formletter 4.3.1 How To: Labels Labels are a common report type that Report Builder can create, provided you have some patience for some trial and error fiddling around with the Detail report band width settings: Create a new report Add a Detail band to the newly created report Resize the Detail band right margin by first selecting the Detail band (left click once on the Detail band - eight red resize boxes will be displayed along the outer edges of the band) and then moving the right side of the Detail band inward to the desired label width: Obviously it would be extremely handy to have a blank sheet of labels that you can measure for the desired label height/width. Remember that the Detail band needs to be large enough to cover the blank space that SURROUNDS each label and not just the printable area of the label itself! The screen cap above shows the resized Detail band. After you've resized the Detail band you can add the desired text/database field information by adding a Frame, and then add the text or database field information. Clean up the information (e.g. remove the frame borders, align the frames into neat columns, etc) and then 2005-2014 Scott Daughtry/Oleg Fomin "How To" Section 100 save the report. Generate the report and print it to a blank piece of paper; place a blank sheet of labels on top of the printed output and hold both sheets together against an overhead light to see if the Detail band needs to be reduced/enlarged in size to properly print onto the label stock. It will take a few tries to get it right, so be patient! A sample output from the screen cap shown above (with text and database field information added to the Detail report band) looked like this in the Print Preview screen: If more space is needed between the labels I would move the right side of the Detail band slightly to the right. If more space is needed horizontally between the labels I would move the bottom side of the Detail band slightly downward, and so on. * NOTE * * NOTE * * NOTE * This type of report would not have any other type of Report Bands added to the report; you will be working with only ONE Detail band! * NOTE * * NOTE * * NOTE * 4.3.2 How To: Mail Merge Report Mail Merge form letters use a combination of database field information and hardcoded text (that you define) to print a formatted report - you probably receive a Mail Merge form letter in your mailbox from solicitors every week! This type of report is easy to create within Report Builder: Create a new report file Add a Detail report band to the report page Double left click the newly added Detail report band to display the Band Detail Properties dialogue box Make sure a check mark is displayed inside the Mail Merge check box and then click the EDIT TEXT button: 2005-2014 Scott Daughtry/Oleg Fomin 101 Fomin Report Builder After you've clicked the EDIT TEXT button a pop up window is displayed to enter your form letter's text: The window is resizable (drag the bottom right corner of the window to make it larger); the screen capture above shows a combination of text and database fields. The top of the window has a small toolbar with six icons; from left to right their functionality is: o Save changes and return to the Report Formatter window o Cut selected text to the Windows clipboard o Copy selected text to the Windows clipboard o Paste Windows clipboard information to the EDIT TEXT dialogue box o Display the Font selection dialogue box o Display the Dictionary To insert the contents of a database field into the form letter click the Dictionary button to select the desired (fields) within the sentence where it should be printed. The example above shows that every time a database field was added to the text that double quotation marks and arrows are needed; the sequence is: Double Quote + Less Than Arrow + Database Field/Variable + Greater Than Arrow + 2005-2014 Scott Daughtry/Oleg Fomin "How To" Section 102 Double Quote When the Dictionary adds a database field/variable to the EDIT TEXT window it will AUTOMATICALLY add the arrow symbols for you; however, it WILL NOT add the double quote symbols (leading and trailing), so YOU MUST DO IT! If you fail to add the double quotes your report will probably fail when it is executed. The fix is easy (find where you failed to add the double quote symbols) - just irritating. * NOTE * * NOTE * * NOTE * * NOTE * You can use the Dictionary to access all of the internal Report Builder functions to modify the database information to suit your needs; examples of what you can do would include: Combining multiple database fields into one formatted text string (e.g. First Name, Last Name) by using the CLIP() function and the Ampersand (&) symbol Use the CHOOSE() function to evaluate a database field and generate the appropriate text field; for example, you have a database field that stores the customer's gender as M or F; you can use the CHOOSE function to instead print Mister or Misses onto the form letter Evaluate the last time the customer was contacted against the current computer date to generate a text string like "it has been 14 months since we last contacted you regarding your policy." * NOTE * * NOTE * * NOTE * * NOTE * The Font Dialogue Box won't allow you to use multiple font types/sizes/styles on the form letter - you can only use one font type/style/size for the form letter! After you have entered the Mail Merge letter information click the OK button to save the text and return to the Report Formatter window. Save the report and run it to see what needs revised/tweaked. 4.4 Sorting Tricks 1. Sort output in descending sort sequence 2. Multiple sort levels within a report 4.4.1 How To: Descending Sort Sequence By default a Sorting Band assumes you want to print database information in ascending sequence (0-9, A-Z); there may be times where you need descending sequence (Z-A, 9-0), especially when dates are involved (e.g. print the most recent transactions first, and then go backwards in time). This is very easy to do: Add a Sorting Band to the report (it is assumed you've already added the Detail 2005-2014 Scott Daughtry/Oleg Fomin 103 Fomin Report Builder band to this report - you can't add a Sorting Band with a Detail band already being defined in the report) Double left click on the Sorting Band to display the Sort Expression dialogue box Click the Dictionary button to select the database field that you want to use to sort the information; after it is inserted into the Sort Expression entry field you need to add a dash character (-) in front of the database field: As shown in the above screen capture, the database field INV:Date was selected from the dictionary; a dash character (-) was added to the first position of the entry field Click the SAVE button to return back to the Report Formatter window; in this example, there were three Sorting Bands for the report (and I modified the third Sorting Band); the Report Formatter window now reflects the changed information, as confirmed by the -INV:Date information: 4.4.2 How To: Multiple Sort Levels See this help topic (link) for instructions how to sort a report using multiple layers 4.5 User-Defined Variables 1. Creating / implementing user variables on a report page 4.5.1 How To: Creating User Variables Creating reusable variables that contain a database field and/or text information can be a time saver if you create a lot of reports: Open the desired report (or create a new report) Open the Dictionary (by creating a new empty frame or an existing frame placed on the report) Click on USER VARIABLES, and then left click on CALCULATED FIELDS: 2005-2014 Scott Daughtry/Oleg Fomin "How To" Section 104 Click the + icon on the Dictionary toolbar to display the Properties window: The screen capture above shows an example of a user variable titled "CityState", with the "Field/Expression To Total" information already filled in. Two different functions (clip and upper) have been used to remove trailing empty spaces and ensure the State database field is printed as upper case on the report page. The "Picture" entry field has been left blank on purpose - this ensures that the information isn't truncated when printed on the report page The "Evaluate On" drop list is left with the default setting of "At Each Record Retrieve" - this setting is EXTREMELY important, because if you change it your output will be very erratic (i.e. the information you thought would print for every database record only prints every 5, or 10, database records, or only once per printed page). If your report output is "goofy" for this user variable, chances are this setting is incorrect! You can combine text with database field information; make sure that you enclose the text with double quotation marks (otherwise a run time error will occur when the report is executed). For example, if you want the text "Location is" printed before the City database field your "Field/expression to total" entry field would resemble this: 'Location is: ' & clip(ZIP:CITY) & ', ' & upper(clip(ZIP:STATE)) Click the SAVE button to save the variable - it will now show up in the Dictionary and can be used in ANY report for that report category! 4.6 Misc Topics 2005-2014 Scott Daughtry/Oleg Fomin 105 4.6.1 Fomin Report Builder Help File Modification History May 2014 Added topic 'How To: Change a Frame's Border/Fill Properties' Moved Band Properties information from the Page Break help topic to the Band Properties Window help topic and fixed some of it's outdated text Fixed the topic 'Basics: Step 15 (Page Breaks)' that contained incomplete instructions on how to force a page break in a report Recompiled into the Windows 7/Windows 8 help file format (*.CHM) Fixed grammatical mistakes in all help topics! 4 Aug 2013 Minor content changes 8 Aug 2005 Content expanded 30 Aug 1996 First version created 4.6.2 How To: Save A Report Step 1: Define the Report Title (that will be displayed within the Report Manager window) Click FILE from the Report Builder Main Menu Select REPORT PROPERTIES from the list of choices Enter text inside the Report Title entry field of the Report Properties pop up window; try to use a short name that accurately describes the report's purpose Step 2: Save the report If saving a BRAND NEW report that you've just created: o Click FILE from the Main Menu o Select SAVE AS from the list of choices o A popup window will appear to enter the file name. o Do NOT use an existing file name! This will permanently overwrite that existing report! o Do NOT change the file extension from the default of .RPT! o After typing in the report name click the SAVE button and wait for the popup window to disappear on it's own (1-5 seconds) o If saving an existing report Using the Main Menu o Click FILE From the Main Menu o Select SAVE from the list of choices 2005-2014 Scott Daughtry/Oleg Fomin