auto_stories Knowledge Base chevron_right Guides chevron_right Article

Print Sample

It is a type of operation that allows the information created on the form to be printed. The form design can be printed as an output design.

mceclip0.png, Resim

Print Action in Property Panel

  

Features

Description: A description of the action is written.

Heading: Specifies the name in the action list when added as a Form Action.

Design File: Write or find the name of the design file by SQL query.

Form: Select the form for printing.

Linked List: If printing from records in a list, the related list is selected.

List-ID Field: Select the UserTableID field in the list.

List Type Field: Select the FormTypeID field in the list.

Print Preview: Decide whether or not to make a print preview. (When there is no print preview, printing is done on the active printer on the server side.)

Run Condition: If the value in the query entered in this field is '0', the related action will not run.

Request Confirmation: Select whether you want to ask for confirmation before running the action. If Request Approval is active, the Approval Message feature is opened and the message to be displayed when requesting approval is written.

 

Creating Output Design on Studio

Let's create two separate forms where we can enter books and their categories. Then, let's design a third form where we can design and print the output. Then let's create our output with actions on the Studio screen.

First, let's create a Category Definition Card form so that we can define the categories to which the books belong.

Resim

The view of the Category Definition Card on the Client screen is shown below. Enter a few categories and save with the 'save' button.

Resim

 

Let's go to the Studio screen and create a new form where we can define the books belonging to the categories and the authors of the books. This form will be opened from the Category Definition Card screen by using the 'Open Form Link' action. The purpose of this action is to ensure that the form is associated with the correct category by mapping with the category ID and to register the books belonging to the relevant category.

 

Resim

Then let's go to the Client screen by adding the 'save' button. Enter the books and authors of the related categories and save them with the 'save' button. In the image below, several books and authors are entered and saved with the 'save' button.

 

Resim 1703130296, Resim

Let's create our third form, called LIBRARY and of Report type, where we can create and print the output design. In this form, let's add a drop-down box where we can list the categories and a button that will perform the 'Print Preview' function.

Resim 654007102, Resim

Then let's write the Sql query that we will use in the output by clicking on the form and adding the 'Open Print Design' action as shown in the image below. Let's write the name we assigned to the output in the Design Name section. Save the action by following the steps below.

Resim

Sql Query

SELECT 
C.Category AS Category,
Book,Writer

FROM Books B WITH (NOLOCK) 
LEFT JOIN Categories C WITH (NOLOCK) ON C.UserTableID=B.CategoryID
  WHERE B.CategoryID='$PCategories$' 

Resim 1780456968, Resim

Add the 'Print' action by clicking the Print button and add the name (LIBRARY) we assigned to the output to the Heading and Design File section.

Resim

Save the project and go to the Client screen with the Run Key. When hovering over the three line icon at the bottom right of the Client screen, the Design Name we have determined appears. When we click on LIBRARY, the screen where we will create the output design will open.

Resim 1243735909, Resim

Resim 1007615366, Resim

 

Let's start creating our design.

Drag and drop the Table tool on the left side to the TopMargin1 area on the design page.

Resim 1336984724, Resim

Let's make their naming from the Text field. For the naming process, first select the cell and then enter the desired name in the Text field.

Resim 416548902, Resim

Delete the cell named TableCell3. For this operation, first select the cell and then click on the field shown with number 2.

Resim 372576000, Resim

blobid0.png When using a table, adding a cell next to it, adding a new row below or above it can be done by clicking on the blocks under the actions section. This is exemplified with the image below.

Resim

Let's delete the field we added for example and continue to create our design, click on the 'Settings' tab from the right side menu and select 'Data Member' from the 'ACTIONS' field. (If the Data Member field is not visible, XtraReport (Report) option should be selected from the drop-down box under Properties). Since the data for the fields in the output design will be taken from the query written in the 'Open Print Design' action created through Studio, 'Octopus_Table_Detail' should be selected as Data Member.

 

Resim 858592661, Resim 
After this stage, following the numbers in the image below, let's drag a second table to the Detail band, delete any unnecessary fields that will not be used, turn down the Detail band, then click on the Data Source icon and click on Octopus_Table_Detail and drag the fields to be displayed in the output to the TableCell3 and TableCell4 fields, which are the fields we dragged as a second table.

blobid0.png There should be no space at the top and bottom of the Table added in the Detail section, it should be positioned without spaces. If there is a gap, the design will not look good because there will be a gap between each row.
blobid0.png Since the data received from the Data Source, multiple values returned from the Query are requested to be displayed in list format, one below the other, the relevant column values should be added to the Detail section.

 

ResimResimResimResim

In the TopMargin1 field, another table tool was added and edits were made to pull the category field. Then click on the three line icon at the top left of the screen. Menu options will appear. Then click Save, type the design name and save our output design.

Resim

Resim 1900527629, Resim 
 

blobid0.png When the Save Report screen opens, the 'Design Name' name we specified in the 'Open Print Design' action should be written in the number two field shown above in exactly the same way.

Let's go to our LIBRARY screen on the client side, select a category from the drop-down box and click the Print button. The preview of the output design we created will be displayed as below.

 

Resim 531523075, Resim

 

 

Resim

 

 

 

 

 

Creating a Client Side Output Design:

In order for the output design created on the client side to work, the screen where we prepare the output must be in 'form' type. First of all, let's add a button called 'Print' to the Category Definition Card screen, which is of the form type.

Resim

Then open the output design page by following the steps below to create a new output design.

Resim 60100817, Resim

 

 

Resim 1884623564, Resim

 

After opening the design page, click on the three line icon in the upper left corner of the screen to add the SQL query that will return the data to be displayed in the output design. Menu options will appear. Then click on the 'Add New Field' option. The image below shows the 'Add New Field' screen.

On this screen, let's first write the name we want to give to our query in the 'Field Name' field. In this example, the name is 'LIBRARY_NEW'. This name will then be used in the action of the 'Print' button on Studio. Thus, the button will be able to correctly identify which output it should print.

Then select the 'Datasource' option from the Type field. In field number 4, let's write our SQL query. Complete our registration process with the Save button and close the related window.

Resim

 

 

Add New Field Query: 

SELECT 
C.Category AS Category,
Book,
Writer
FROM Books B WITH (NOLOCK)
 
LEFT JOIN Categories C WITH (NOLOCK) ON C.UserTableID=B.CategoryID 
WHERE C.Category= '$PCategory$' 

After saving the query, let's save the output by following the steps below. The output name must be the same as the name you wrote in the Field Name field. Close and reopen the design page.

Resim 142234790, ResimResim 893126220, Resim 

 

Resim 1062113113, Resim

 

 

Let's open the design page from the Client screen as shown above. Then let's create our design as in the picture shown below. While the Properties field XtraReport (Report) is selected, in the Data Member field, the name of our query that we have added in the Add New Field section will appear. Since the data for the fields in the output design will be taken from this query, let's select LIBRARY_NEW in the Data Member field. Then click on the Data Source icon and drag and drop the fields into our design after viewing the relevant fields.

 

blobid0.png  In the window named Report File List, the output design that we previously created with the Open Print Design action on the Studio side is also seen. However, the output design created by Studio should not be opened and saved from the Report File List window. We use this window to open and edit the outputs prepared by the Client.

ResimResim

 

Let's save our output design by following the steps below. If you close the screen without saving, the changes you have made to the design will not be saved and will be displayed as before when it is opened again.

Resim 947437923, Resim

blobid0.png  For the output design created on the client side to work, the screen where we prepare the output must be in the 'form' type. At the same time, the UserTableID value of the screen must be full before pressing the Print button. We can achieve this by filling the information of a previously created record on the screen into the form. In this example, an action has been added so that when the row in the list is clicked, the information of the selected row is filled in the form. All Form option is selected in the Value Area field of the action. Thus, data is filled in the Category and UserTableID fields on the screen. Then the output is opened with the 'Print' button.

Let's go to the Studio screen. By adding Print action to our button named Print, let's write the name of the output design we want to print in the Design File and Heading fields. In the Form field, select the name of the source form used for the output, that is, where the data in the output comes from, and save the action. Let's save the project and go to the Client screen with the Run button.

 

Resim 1821478701, Resim

Resim 673034496, Resim

Resim

On the Client screen, select a category name from the list, fill the text field above and click the 'Print' button. You can see the preview of the printing process as below. Registered books belonging to the relevant category are listed in your printout.

Resim