Tuesday, November 28, 2017

Working with Views

Use Views (GESAVW) in the Development > Data and Parameters block to create and modify views, by describing their characteristics in the data dictionary for the folder.

  • Views allow you to do the following:
    • Avoid opening a table in a folder, such as archived folders.
    • Access data in several folders for report development.
    • Use SQL Server functionality that was previously inaccessible, such as union or group by.
  • Views are accessed like files with the [F:xxx] method. Views can be accessed using the formula editor and Crystal Reports. Programming relating to a view is similar to programming for a table (it has its own class [F]). The following instructions are available for the views:
    • (local) File, close (local) File, Filter, For…Next, Read, Columns, Link

  • The view name cannot have the same name as a table in the dictionary. It is a unique identifier and can contain from 1 to 10 letters or numbers, but must start with a letter.
  • You can create views on tables from different folders.

Query tab


Use the Query tab to write the query that will be used to create the view.

  • The query must be written in the same programming language as the current database in the folder.
  • It is preferable not to hard code the folder name into the query so that the query can be used with another folder when it is copied.

  • The activity code and module are used in conjunction to identify whether the view will be created in the database of the folder.
  • If fields submitted to an activity code or folder name need to be specified in the query, it is recommended that you use formulas.
  • The Open access check box is used to restrict the access to the database table within the folder owning the table and certain authorized folders. Changing the setting at this field requires a re-validation of the table.

Fields tab


Use the Fields tab to define all the fields of the view. The description of the fields must be fully compatible between the Query tab and this tab (number, order, and field type).
  • The compatibility check is performed during validation.
  • These fields can exist in the table dictionary, although it is not mandatory.

  • The query must be written in the same language as the current database in the folder.
  • The Menu column defines the local menu associated with the field.

Keys tab


Use the Keys tab to define all the keys available to sort the view.

  • The Key code field corresponds to the name under which the key is known in Order By.
  • A list of fields that make up the index is entered in the Key description field. Fields are separated by a plus sign.
  • The standard naming convention for views consists of using the abbreviation for the view, followed by 0 for the principal key, by 1 for the second key, etc. For a customization, be sure to start the code with X, Y, or Z.
  • When copying views to other folders, the Copy button only copies the view description to the other folder. You must validate this description in the other folder so the view can be created.

Validation


Click Validation in the Right panel to create the view in the database.


-
Sage X3 and Sage Software are trademarks of Sage Software, Inc. Microsoft SQL Server, Microsoft SQL Enterprise Manager and SQL Server Management Studio are registered trademarks of Microsoft Corporation. Oracle is is a registered trademark or Oracle Corporation. All other product names used here are trademarks or registered trademarks of their respective owners.
-