NUMBER : 3167 PRODUCT : ReportSmith VERSION : All OS : All DATE : December 11, 1996 TITLE : Frequently Asked Questions about Formatting This document contains a listing of the most frequently asked formatting questions and their answers. Included in this document is a section for alignment, characters, headers/footers, pagination, report sections, report styles, row height, and a miscellaneous section. Alignment Q: How can I automatically center a report variable on the top of a report when the length of the report variable changes? A: Create a macro derived field to add leading and trailing spaces to the report variable data. For example: Sub AddSpace() TestVar = GetRepVar("MyRepVar") StringLen = Len(TestVar) MaxSize = 40 if StringLen < MaxSize then SpaceToAdd = Int((MaxSize - StringLen) / 2) TestVar = Space(SpaceToAdd) + TestVar + Space(SpaceToAdd) end if DerivedField TestVar End Sub This example uses 40 as the maximum length of a report variable. Change this value to your specification. Insert the macro derived field instead of the report variable and center it. It should then stay centered even when the length of the report variable changes. Characters Q: How do you change the default font in ReportSmith? A: The Report Style selected determines the font that will be used. Create another Report Style and specify the default font you want. To do this: 1. Choose Format | Report Styles. 2. Click New, enter a name and click OK. 3. Click Edit and select Character fields. 4. Click Character. Select your specific font, font style, size, effects, and color. Click OK twice. 5. To apply to an existing report, click Apply. 6. To use when creating a report, select Style, select your custom style, and click OK. A custom style can also be used as the Default Style by clicking the "Use As Default" button in the New Report Style dialog box. Q: ReportSmith only lists fonts with a point size of 8 or more. Can I use a smaller point size? A: Yes, even though a smaller size is not listed, you can manually enter the size you want by choosing Format | Font. Q: How can I get ReportSmith to display international characters correctly? A: A line, LD=yourlanguagedriver, can be added to your WINDOWS\RS_SQLIF.INI file. The language driver that needs to be specified is determine by the data source and language driver that was used to create the data. Run the Borland Database Engine Configuration Utility, IDAPICFG.EXE or BDECFG.EXE, choose your specific driver name and check the LANGDRIVER parameter. Specify the same driver in the RS_RSQIF.INI file. For example, if you are connecting to a SQL Server database, the language driver may be SYSC850. If this is the case, add the following line to your [SQL Server] section: LD=SYDC850 Headers/Footers Q: I want to have a field displayed on the top of every page, however, if I put the field in the page header, it doesn't always display the correct data. Is there a work around for this? A: In ReportSmith version 2.5.x and below, page headers are static. What you will actually see is the data field from record number 1 on page 1, data field from record 2 on page 2, etc. One work around is to place the necessary field in a group header, however, if a group takes up more than one page the field will only display on the first page of the group. Instead, choose Insert | Field Labels and check "New page". Increase the field label section and insert your fields in that section. To do this, position your mouse pointer to the left side of the field labels, outside the printable area, until the pointer turns into an arrow pointing to the right. Then drag the bottom, middle handle down to increase the size of this row and insert your fields. In ReportSmith 3.0, you can add fields to the page header and they update as they should. Miscellaneous Q: Why are my fields displaying all XXX's rather than the actual data? A: Usually the reason is because the fields are placed outside the page boundary. Another reason may be that the query did not return any records and then the fields were inserted through Insert | Fields. Q: When I try to format a column containing percentages in a crosstab report, the change doesn't take effect. How can I correct this? A: Select the entire crosstab, right-click, and choose Modify. Select the Options button below the Name section, uncheck Format Pct and click OK. You should now be able to select the column containing the percentages, right-click, choose Field Formats, and select the applicable format code. Click OK and the changes should now take effect. Q: Why do my inserted fields not display or show incorrect data on the second page of a form report. A: If you extend the detail section of your Form report so that each form spans two or more pages and insert a field into the Page header, the information will not display correctly. This is because ReportSmith is still honoring the rule of one record per page even though you have extended the detail section to cover two pages. A work around is to choose Format | Repeat Items. Select a number that represents the number of pages per form. Q: How can I create a report with columns that "Snake", like newspaper columns? A: ReportSmith cannot perform this functionality in a columnar report, however, a label report can be used to display records in a side-by-side manner by using a Label report. Resize each label as a column to hold each record. Pagination Q: I am creating a "Form" report using a table which contains more fields than will fit on one page. Is there a way to instruct ReportSmith to automatically increase the number of pages for this form report and insert all the additional fields on the next page of the report? A: No, ReportSmith is designed to create a "Form" report consisting of one page per record. You can, however, select the form and drag the bottom handle down to increase the number of pages per record. Then insert each field manually by choosing Insert | Field. Q: In a columnar report, I would like to have a blank line inserted in between every 5 lines of data. Is this possible? A: Yes, choose Tools | Report Grouping, select any column and click New Group. Click Group Properties. Change "Group by" from "Same Value" to "Every", change Records to 5, and click OK, and OK again. Next choose Insert | Headers/Footers, select your new group, click footer, and click OK. You can adjust the size of the footer if necessary. Q: How do you limit the number of records in the detail section and then start a new page? A: You can create a group based on the same value or "x" number of records. To do this, insert a group header or footer. Choose Tools | Report Grouping, select the group you just created under Defined Groups and press the Group Properties button. Change the "Group By" selection from "Same Value" to "Every", and the Records to your specific value. Click OK and then OK again. To insert a page break, choose Format | Section, select your group header or footer and check "New Page After". Q: How to get ReportSmith to print "Page x of y" on each page. A: To display "Page x of y" on each page, where "x" is the current page number and "y" is the total number of pages, you can insert the System Field "Page Number" in the page header or footer, along with a derived field based on the following macro: Sub Tpage() x = TotalPages() DerivedField x End Sub Q: How to display the current page number if not on the last page. A: Create a macro derived field and insert it into a page header or footer. The first example will display the page number only. The second example will display "Page x of x". Sub ShowPages() If CurrentPage() <> TotalPages() Then DerivedField Str(CurrentPage()) else DerivedField "1" End If End Sub 'Alternative Macro Derived Field to display "Page 1 of x" Sub ShowPages() If CurrentPage <> TotalPages Then DerivedField "Page " + Str(CurrentPage) + " of " + Str(TotalPages() - 1) else DerivedField "Page 1 of 1" End If End Sub Q: How to display Page # of Page # (i.e., 1 of 3) in a page header or footer. A: Create the following macro derived field and then insert the derived field into a page header or footer: Sub PageOfPage() C = Str(CurrentPage()) T = Str(TotalPages()) DerivedField C + " of " + T End Sub Q: How can I get ReportSmith to reset page numbers whenever a group breaks. A: The report should have a report variable, based on the field on which it has been grouped, which then becomes part of the selection criteria. The macro connects to the table and gets a distinct, unique, set of records on which the report has been grouped. Looping through the data set record by record, it loads the report, supplying the report variable and its value as the second parameter. Once all reports have been loaded, it loops through the data set a second time in order to print and close each one. An example macro follows: Sub LoadAndPrint() Dim ds As Data set '61 = PARADOX (IDAPI) Connection ds.Connect 61, "", "", "", "" 'Get a distinct, unique, set of records (Exclude duplicates) SQL$ = "SELECT DISTINCT EMPLYEE_ID FROM 'C:\RPTSMITH\VIDEO\EMPLOYEE.DB'" ds.SetUserSQL SQL$ ds.Recalc 'EMPLYEE_ID is the group break, so it should be the report 'variable. For I = 1 to ds.RecordCount ds.Record = I LoadReport "X:\PAGE.RPT", "@Emp_Id=<" + ds.Field("EMPLYEE_ID") + ">" DoEvents Next For I = 1 to ds.RecordCount PrintReport DoEvents CloseReport 0 DoEvents Next ds.Disconnect End Sub Report Sections Q: I dragged my detail section off the bottom of the page and now all my data disappeared. How can I get it back? A: Choose File | Page Setup | Size and Orientation. Change paper size to legal or choose Custom and increase the height. Once you can see your data, drag the detail section back up where it belongs and change your page setup to the original setting. If you didn't actually drag the detail section and this section is missing, choose Format | Section, select Detail section and uncheck "Hide Section". Report Styles Q: When I choose Format | Report Styles, the New button is disabled. What could be causing this? A: By default, report styles are stored in the RPTSMITH directory. If ReportSmith is loaded from a network, you may not have full rights to that directory. To instruct ReportSmith to store your report styles to another directory, add the following in your WINDOWS\RPTSMITH.INI [ReportSmith] directory: ReportStylesPath=c:\rptsmith (or any valid directory you have full rights to) This setting will enable you to create columnar, label, and form report styles. To create crosstab styles, add the following line in your WINDOWS\RPTSMITH [CrossTab] section: CrossTabStylesPath=c:\rptsmith (or any valid directory you have full rights to) Row Height Q: I have applied "Can Grow" and "Can Shrink" to a column containing memo fields and ReportSmith is not displaying the entire data for each record. A: Choose View | Zoom and set Magnification to 100% or click the "Scales page to 100% view" button on the Toolbar. ReportSmith will reformat the report and the complete memo field data should display correctly. Q: I applied "Can Grow/Can Shrink" to a field in my form report and now some of my fields overlap one another. Why is this? A: "Can Grow/Can Shrink" is designed to work in the Detail section of a Columnar report only. Q: How can I change the column title in a columnar report to two lines? A: To use two lines for a column heading do the following: 1. Place your pointer on the left hand margin by the column headings. The pointer will turn into a bold arrow pointing to the right. Click the left mouse button to select the heading section. 2. Drag the middle handle (black square box) down to increase the size of this section. 3. Click the "Field editing mode" button on the toolbar. 4. Select a column heading and drag the handle down to increase the size of that label. 5. Edit the column label text and insert a carriage return to get a second line. You can also use a macro derived field with embedded line feeds - Chr(13) - to control the width of each line vs. making all lines the same width by resizing. DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.