NOTE: The RPD format is accepted by Rpv Reports to maintain compatibility with previous versions of Rpv. The recommended format to be used with templates is RPX. See Reports in RPX format
The reports based on RPD files are the easiest to be generated. This kind of reports has, however some limitations related with the ammount of data that an be shown. For example, this format is the recommended for reports of one or two fixed pages. This could be the case of an invoice when we know that it will always have only one page.
How to begin?
The recommended way to begin is to generate an RPD file with the data that will be printed. It is not required that the data is real.
Here, we will see the data for a VERY SIMPLE INVOICE to demonstrate how to create a template quickly.
Let's see an RPD file that we will create. Its name will be "C:\TEST.RPD"
Contents of C:\TEST.RPD
TEMPLATE=C:\INVOICE.RPV
@invoice_no=123456
@cust_no=112233-8
@cust_name=Charles Murray
@address=401 Dewitt Ave Belleville 07109 NJ.
@zip=12533
@date=12/12/2017
@qty_01=2
@des_01=PEN DRIVE USB
@pri_01=55
@qty_02=4
@des_02=WIRELESS MOUSE
@pri_02=5
@qty_03=
@des_03=
@pri_03=
@qty_04=
@des_04=
@pri_04=
@total=130
|
Once the file is saved on disk, we will generate a new report by selecting the option File / New.
This screen will be shown:
After the file has been verified by the Visual Editor, just click on the button "Create template from this file". A template will be automatically created containing all the variables.
After that, we will move the variables to draw the invoice.
It will be probably needed also that the section has to be resized. It is done from the properties of the section or moving up and down the bottom line of the section.
Once there is enough room, we will begin with the invoice.
Is evident that this is a very easy example and doesn't represent a real invoice.
If we observe the form we will note some pictures, boxes but also labels and variables. The variables are defined by the RPD file that we generate before.
Which is the real difference between a label and a variable?
The answer is NONE. A variable is just a label that contains the name of the variable as the expression. In run time the expression will be changed by the values taken from the RPD.
Inserting a @variable
It will be only necessary to click on the "@" button on the main toolbar and to place the variable within the section you want to insert it to. Another option is to place the pointer of the mouse on the place you want to insert the variable and press CTRL-D.
Is it possible to combine in a label a fixed expression with a variable?
Yes, it is possible. For example, if we see the invoice we will see a label "Invoice: @invoice_no".
Previewing the report
To see the report, it will only be necessary to press F5 key or to select the option View Report from the menu.
We see here that the variables have been changed by the values included in the RPD file.
Finishing the report and calling it from our program.
Once the template it's done the template must be saved with a name. The extension of the template will be RPV. The file for this example will be named as: C:\INVOICE.RPV
After that, the RPD file will specify the RPV template that we just generated with the Visual Editor:
TEMPLATE=C:\INVOICE.RPV
Where "C:\INVOICE.RPV" is the file that we just saved. Below this line we will add the rest of the data. The file, then will look like the following:
Contents of C:\TEST.RPD
TEMPLATE=C:\INVOICE.RPV
@invoice_no=123456
@cust_no=112233-8
@cust_name=Charles Murray
@address=401 Dewitt Ave Belleville 07109 NJ.
@zip=12533
@date=12/12/2017
@qty_01=2
@des_01=PEN DRIVE USB
@pri_01=55
@qty_02=4
@des_02=WIRELESS MOUSE
@pri_02=5
@qty_03=
@des_03=
@pri_03=
@qty_04=
@des_04=
@pri_04=
@total=130
|
How to call it from our program.
This specific task can be performed in several ways depending on the programming language that you use. In every case, the file that must be called is the RPD file and not the template one. In case that the RPV file is called (template) we will see the form with all the variables.
For example, if we use Visual Basic we can call the report like this:
Shell "c:\program files\rpv\rpv.exe C:\TEST.RPD"
From Cobol:
CALL 'SYSTEM' USING 'rpv.exe C:\TEST.RPD'.
See also
Reports in RPX format
|