WinVask -  Faktura

Basics: Step 9 (Combining Info Into A Frame)

Basics: Step 9 (Combining Info Into A Frame)

Previous topic Next topic  

Basics: Step 9 (Combining Info Into A Frame)

Previous topic Next topic  

 

Our sample report is shaping up nicely; how about we clean up the city, state and zipcode information so it prints nicer on the page?   We've opened up the report so the Report Formatter is onscreen:

 

frb_bm86

 

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 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

 

We'll also have to play with the column headers abit, since there will no longer be 3 individual columns of information. However, armed with the tricks presented on Page 8 of this tutorial this will be very easy to achieve.  Here is one way to achieve 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 manuever in
ð        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)
ð        Now we need to 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 cleaning up the City/State/Zipcode information, and our FRAME Contents look like this:

 

frb_bm87

 

 Now we need to change the Picture to accomodate 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 abit to save space on the output. Go ahead and click the Picture tab on the FRAME properties box. Right now the picture entry field is completely blank:

 

frb_bm88

 

Click on the "face" icon to display the Picture Wizard. A popup window of picture types is shown onscreen:

 

frb_bm89

 

The FRAME that we created for the 3 combined database fields contains a String, so choose the String radiobutton and click NEXT. You are prompted for the maximum length of this string:

 

frb_bm90

 

The default value is 20 positions; we'll change this to 45, and then click OK. Now our Picture entry field in the Frame Properties box looks like this:

 

frb_bm91

 

You will also notice that the FRAME contents in the DETAIL band have changed to dollar ($) signs. Go ahead and resize the new FRAME to the correct length, then align it to be lined up horizontally with the other FRAMES in the DETAIL band.

 

Now we can delete the headers for Zip Code and State (right click the FRAME, then select DELETE from the popup 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. 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.

 

Go ahead and 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:

 

frb_bm91

 

Go ahead and save the changes and then print a sample report to see how everything looks:

 

frb_bm92

 

Quite a 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 data
ð        How to use the Picture Wizard dialogue box to change a FRAME Picture
ð        That a detail band can contain multiple lines for the same database record to clean up it's appearance

 

Next Tutorial Page