+ All Categories
Home > Documents > introduccion_genexus

introduccion_genexus

Date post: 03-Jun-2018
Category:
Upload: nestor-rodriguez
View: 215 times
Download: 0 times
Share this document with a friend

of 47

Transcript
  • 8/12/2019 introduccion_genexus

    1/47

    Getting Started

    with GeneXus 8.0November, 2003

    MONTEVIDEO URUGUAY Av. 18 de Julio 1645 P.4 - (5982) 402 2082CHICAGO USA 400 N. Michigan Ave. Suite 1600 - (312) 836 9152MEXICO CITY MEXICO Mariano Escobedo 353 A Of. 701 - (5255) 5255 4733SAO PAULO BRAZIL Rua Samuel Morse 120 Conj. 141 - (5511) 5502 6722

  • 8/12/2019 introduccion_genexus

    2/47

    Getting Started with GeneXus

    Copyright ARTech Consultores S. R. L. 1988-2003.

    All rights reserved. This document may not be reproduced in any form without the expresspermission of ARTech Consultores S.R.L. The information contained herein is intended for personal

    use only.

    TRADEMARKS

    ARTech GeneXus are trademarks or registered trademarks of ARTech Consultores S.R.L.All other trademarks mentioned herein are property of their respective owners.

    Page 2 of 47

  • 8/12/2019 introduccion_genexus

    3/47

    Getting Started with GeneXus

    Content

    Introduction .................................................................................................................... 4Objectives .................................................................................................................... 4

    System Requirements....................................................................................................... 4Generator Requirements ................................................................................................ 5

    Trial Version Limitations.................................................................................................... 6

    Installation and Setup....................................................................................................... 7Setup Wizard................................................................................................................ 7

    Trial Version Authorization................................................................................................. 9Getting Started Step by Step ............................................................................................10

    Step 1: Creating a Knowledge Base................................................................................10Step 2: Creating an Object in GeneXus...........................................................................10Step 3: Defining Attributes for the Object Transaction Invoice............................................11Step 4: Viewing the Completed Objects Form ..................................................................12Step 5: Defining Formulas in GeneXus............................................................................13Step 6: Inserting a Business Rule ..................................................................................15Step 7: Reviewing the Database after Creating the Invoice Object......................................16Step 8: Creating a Customer Object...............................................................................18Step 9: Viewing Table Structure Changes........................................................................19Step 10: Prototyping your Application in Visual Basic with Microsoft Access..........................20Step 11: Viewing the Database Creation Report...............................................................22Step 12: Creating the Tables with the Database Manager..................................................23Step 13: Specifying and Generating your Code ................................................................24Step 14: Running your Application .................................................................................26Step 15: Adding New Objects to your Project: Item Transaction.........................................27Step 16: Viewing Table Structure Changes......................................................................29Step 17: Impacting the Database ..................................................................................29Step 18: Refactoring the Data and Generating the Programs .............................................30Step 19: Running your Application .................................................................................32Step 20: Creating a Report & Making a Call to It ..............................................................32Step 21: Specifying and Running your Application............................................................36How to Move your Application to .NET and JAVA ...............................................................38Step 1: Deploying your Application to .NET with Microsoft SQL Server.................................38Step 2: Viewing the .NET Application Running .................................................................42Step 3: Deploying your Application to Java with Microsoft SQL Server.................................42Step 4: Viewing the JAVA Application Running .................................................................46

    Online Resources ............................................................................................................47GeneXus Community ....................................................................................................47Support ......................................................................................................................47How to Buy .................................................................................................................47

    Page 3 of 47

  • 8/12/2019 introduccion_genexus

    4/47

    Getting Started with GeneXus

    Introduction

    ObjectivesThe objectives of this document are that you:

    Discover the power of knowledge-based development

    Experience the key features of GeneXus:o Knowledge-based design

    o Automatic code generation

    o Automatic database and code maintenance

    o Multi-platform deployment

    System RequirementsGeneXus Trial includes the following products:

    Development EnvironmentIt is an Integrated Development Environment (IDE) for designing and prototyping your

    applications, regardless of the production platform.

    GeneratorsGeneXus generates native code for the leading platforms. The generators available are the

    following:

    .NET

    Java

    Visual Basic

    Below is a list of the hardware and software you will need in order to run GeneXus and theapplications generated by it.

    Processor: 500 MHz Intel Pentium classMemory: at least 64 MB of RAM (256 MB recommended)

    Hard disk: at least 50 MB of free disk space to install theDevelopment Environment, plus an average of 10 MB for each

    generator.To create GeneXus applications you will need additional space

    or a shared disk to create the Knowledge Bases.

    Hardware Requirements

    Video: 800 x 600 resolution or higher, with 256 colors

    Microsoft Windows 98 or higher. If you are using Windows NT,

    you must install service pack 6.0 or higher

    Microsoft .NET Framework 1.1 Redistributable Package 1

    Software Requirements

    Microsoft Internet Explorer 6.0 SP1 or higher

    1 The .NET Framework 1.1 Redistributable Package can be downloaded from Microsofts website:http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asp.It can also be downloaded from the Download Center at GXTechnical website:http://www.gxtechnical.com/main/hdcenter.aspx?2,5,36,1035

    Page 4 of 47

    http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asphttp://www.gxtechnical.com/main/hdcenter.aspx?2,5,36,1035http://www.gxtechnical.com/main/hdcenter.aspx?2,5,36,1035http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asp
  • 8/12/2019 introduccion_genexus

    5/47

    Getting Started with GeneXus

    Generator RequirementsThis section contains the requirements to generate and execute applications with the differentGeneXus generators:

    Generator Requirements

    .NET Microsoft .NET Framework 1.1 Redistributable Package 2

    For generating Web interface applications you will need IIS 5.0 or higher(available on Windows 2000 or XP)

    For generating Windows interface applications or printing PDF reports,

    you will need Visual J# Distribution Package 1.1 3

    ODBC Driver for the DBMS used

    Java Sun and/or Microsoft JDK (we recommend having both)

    For generating Web interface applications:

    o Web Server

    o Servlet Engine

    o JavaServer Web Development Kit

    For generating 3-tier Windows interface applications:

    o HTTP: you will need a Web server and a servlet engineo CORBA: you will need Visibroker

    JDBC Driver for the DBMS used

    Visual Basic Microsoft Visual Studio 6.0, with Service Pack 5 or higher

    MDAC 2.6 or higher

    If you use Sheridan Data Widgets, you will need version 3.0 or higher

    installed

    ODBC Driver for the DBMS used (except if you are working with MicrosoftAccess)

    In addition, to create the database and execute the generated applications, you must have some

    of the following DBMSs installed:

    Generator DBMS

    .NETJava

    DB2 Universal Database DB2 UDB for iSeries

    Informix

    Oracle

    PostgreSQL

    SQL Server

    Visual Basic Access

    DB2 Universal Database

    DB2 UDB for iSeries

    Informix

    Oracle

    PostgreSQL

    SQL Server

    2The .NET Framework 1.1 Redistributable Package can be downloaded from Microsofts website:http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asp.It can also be downloaded from the Download Center at GXTechnical website:http://www.gxtechnical.com/main/hdcenter.aspx?2,5,36,1035

    3You can obtain Visual J# Distribution Package 1.1 from Microsofts website:http://msdn.microsoft.com/vjsharp/downloads/howtoget/default.aspx

    Page 5 of 47

    http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asphttp://www.gxtechnical.com/main/hdcenter.aspx?2,5,36,1035http://msdn.microsoft.com/vjsharp/downloads/howtoget/default.aspxhttp://msdn.microsoft.com/vjsharp/downloads/howtoget/default.aspxhttp://www.gxtechnical.com/main/hdcenter.aspx?2,5,36,1035http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asp
  • 8/12/2019 introduccion_genexus

    6/47

    Getting Started with GeneXus

    Trial Version LimitationsAlthough the license is Unlimited, and all the generators installed remain authorized with a unique

    Site Key, some restrictions apply to the number of objects: Transactions: 30; Work Panels(included the GeneXus selection prompts): 50; Web Panels (included the GeneXus selection

    prompts): 50; Procedures: 20; Reports: 20.

    It is not possible to open a knowledge base developed with GeneXus standard version from

    GeneXus Trial or vice versa.

    GeneXus Trial installation is local and single-user (there is no network installation).It does not include the Knowledge Manager's "Distribution" options. Xpz GeneXus standard

    versions can be consolidated (provided they do not exceed the previously mentioned limits) butthey cannot be distributed.

    Support for GeneXus Trial is limited. If you have any doubts or problems about versioninstallation and activation only, please send an e-mail to [email protected]. For any

    additional information, we recommend contacting your local distributor

    (www.genexus.com/distributors).

    Page 6 of 47

    mailto:[email protected]://www.genexus.com/distributorshttp://www.genexus.com/distributorsmailto:[email protected]
  • 8/12/2019 introduccion_genexus

    7/47

    Getting Started with GeneXus

    Installation and SetupThis section explains how to use the Setup program to install GeneXus Trial on a computer.

    The Setup program includes a wizard to help you make the correct choices.

    To start the GeneXus Setup program:

    1.Start Windows.

    2.Run GeneXus Trial Setup.3.Follow the Setup Wizard instructions to install the selected products (Development

    Environment and Generators).

    Setup WizardThe first screen you will come across is the setup wizard welcome screen: click Nextif you wishto continue with the installation.

    The following screen is a License agreement that you should read carefully before continuing tothe next one. After selecting the I accept the License Agreementoption and clicking Next,

    the following dialog asks you to register your name and company name. Once you have entered

    that information, click Nextto display the following dialog box:

    Figure 1 Setup wizard for GeneXus Trial

    In this dialog you select the destination folder where GeneXuswill be installed (a directory calledgxw80Trial is suggested). By clicking the Browsebutton you will be able to change the default

    one. Click Nextto go to this dialog:

    Page 7 of 47

  • 8/12/2019 introduccion_genexus

    8/47

    Getting Started with GeneXus

    Figure 2 Product selection dialog box

    Once you have selected the destination folder, you will be asked for the products you want to

    install (i.e. Development Environment and the different Generators). Then, click Next to beginthe installation.

    After all the files you need have been copied to your system, the Setup program places GeneXus

    icons in a GeneXus group that will be automatically incorporated to your Program Manager's

    window.

    Page 8 of 47

  • 8/12/2019 introduccion_genexus

    9/47

    Getting Started with GeneXus

    Trial Version AuthorizationThis is a detailed description of the steps to authorize GeneXus:

    1. Execute GeneXus 8.0 Trial Versionfrom the desktop shortcut for GeneXus 8.0 or from the

    programs menu.

    2. Copy the Site Code:

    Figure 3 Registration dialog box

    3. In order to activate the GeneXus Trial version, go to www.genexus.com/trial/authorize and

    enter the Site Code obtained in step 2. Then, click Submit to have the activation keygenerated and sent to your e-mail address.

    4. After receiving the activation key, proceed with the product activation. Then you will be able tostart using GeneXus Trial.

    Page 9 of 47

    http://www.genexus.com/trial/authorizehttp://www.genexus.com/trial/authorize
  • 8/12/2019 introduccion_genexus

    10/47

    Getting Started with GeneXus

    Getting Started Step by Step

    The objective of this Getting Started guide is to help you easily evaluate GeneXus and test its

    functionality. We have created a step-by-step process for you to create a small project that is asimplification of a companys reality. In this example you will create an Invoicing System and

    have the possibility to prototype in three different platforms: Visual Basic, .NET and JAVA.Although it covers the whole cycle of a standard process, this process is a simplified version that

    shows you the power of GeneXus and how easy it is to create applications and migrate them tonew platforms.

    Step 1: Creating a Knowledge Base

    1. On the File menu, click NewKnowledge Base.

    2. Name the Knowledge Base Demo

    and click OK to continue.

    Figure 4 New Knowledge Base creation

    Step 2: Creating an Object in GeneXus

    1. On the Objectmenu, click New

    Object.

    2. Select the type of

    object that youwant to create:

    Transaction.

    3. Name the Object:Invoice.

    Figure 5 Object creation dialog box

    Page 10 of 47

  • 8/12/2019 introduccion_genexus

    11/47

    Getting Started with GeneXus

    Step 3: Defining Attributes for the Object Transaction Invoice

    1. Type the attribute characteristics (name, type and description) on the Invoice Structuretab based on the following table.

    2. Use the TAB button to move between the attribute name, type and description. Use theENTER button to add a new attribute.

    ATTRIBUTE TYPE DESCRIPTION

    InvoiceId Numeric(3,0) Invoice

    InvoiceDate Date Invoice Date

    CustomerId Numeric(5,0) Customer

    CustomerNm Character(30) Customer Name

    Now Press CTRL+ L

    ItemId Numeric(5,0) Item

    ItemDsc Character(15) Item Description

    ItemPrice Numeric(7,2) Item Price

    ItemQty Numeric(3,0) Item Quantity

    ItemLnTot Numeric(7,2) Line Total

    Now Press ENTER, and then CTRL + LEFTInvoiceSubTot Numeric(7,2) Invoice Sub Total

    InvoiceTax Numeric(5,2) Invoice Tax

    InvoiceTotal Numeric(7,2) Invoice Total

    3. After entering the attributes, click Save .

    Now you have created the structure of an

    Invoice transaction composed by two

    levels; the Invoice Header where wespecified all the information necessary for

    the Header of the Invoice, and the InvoiceDetail where we specify the information

    that will be repeated for every invoice line.

    The brackets indicate that for each Invoice

    Header there are many Lines or InvoiceDetail. Every group of attributes between

    brackets belongs to a transaction LEVEL.Transactions can have many levels, and

    these levels may be nested or parallel.

    Figure 6 Invoice structure

    Invoice

    Detail

    InvoiceHeader

    Page 11 of 47

  • 8/12/2019 introduccion_genexus

    12/47

    Getting Started with GeneXus

    Step 4: Viewing the Completed Objects Form

    Once all the attributes have been defined and saved, your object form will look as follows:

    1. Select the Formtab of the transaction.

    Figure 7 Transaction form tab

    When defining a Transaction, a default Form is automatically created by GeneXus to specify the

    way the end user will access data in Windows applications. This form can be changed by thedeveloper.

    Page 12 of 47

  • 8/12/2019 introduccion_genexus

    13/47

    Getting Started with GeneXus

    2. Select the Web Form tab of the transaction.

    Figure 8 Transaction web form tab

    When defining a Transaction, a default Web Form is automatically created by GeneXus to specifythe way the end user will access data in Web applications. This Web Form is based on a default

    Theme object, which is a new object introduced in the latest GeneXus version.The Theme object improves the development and maintenance of Web applications by separating

    the developers work from the designers.

    Step 5: Defining Formulas in GeneXus

    Now lets define some calculated fields. You do this by defining formulas.

    In this example we will make the following formulas:

    o ItemLnTot = ItemPrice * ItemQtyo InvoiceSubTot = SUM(ItemLnTot)

    o InvoiceTax = InvoiceSubTot * .085 4o InvoiceTotal = InvoiceSubTot + InvoiceTax

    4Note: Most likely you will want to read the tax % from a table, but in this example we will just hardcodethe tax % for simplicity.

    Page 13 of 47

  • 8/12/2019 introduccion_genexus

    14/47

    Getting Started with GeneXus

    1. Choose the Line Total attribute (ItemLnTot) and double-click the Formulafield.

    2. Write the following expression: ItemPrice * ItemQty.

    Figure 9 Transaction formula

    3. Repeat Steps 1 and 2 for the other three formulas.

    Figure 10 More Transaction formulas

    Page 14 of 47

  • 8/12/2019 introduccion_genexus

    15/47

    Getting Started with GeneXus

    Step 6: Inserting a Business Rule

    In this case we want to have the Invoice Date defaulted to Todays date.

    1. Select the

    Rulestab.

    Figure 11 Rules tab

    2. On the Insertmenu, click Rule.

    3. Select the Defaultrule that assigns

    a default value to an attribute or

    variable.

    4. Write down the following:

    Default(InvoiceDate, today());which indicates that the default

    value for the invoice Date will betodays date.

    5. Click Save.

    Figure 12 Transaction rule

    Page 15 of 47

  • 8/12/2019 introduccion_genexus

    16/47

    Getting Started with GeneXus

    Step 7: Reviewing the Database after Creating the Invoice Object

    1. On the Toolsmenu, click List Database.

    2. Clear the Modifiedcheck box.

    3. In the Select Objectdialog box, click Select Alland then click OK.

    Figure 13 Select Object dialog box

    Page 16 of 47

  • 8/12/2019 introduccion_genexus

    17/47

  • 8/12/2019 introduccion_genexus

    18/47

    Getting Started with GeneXus

    Step 8: Creating a Customer Object

    To create the Customer Transaction follow Steps 2 and 3. The following attributes will be inserted

    in the Customer Transaction Structure:

    ATTRIBUTE TYPE DESCRIPTION

    CustomerId --------- --------------------

    CustomerNm --------- --------------------

    CustomerAddress Character(30) Customer Address

    CustomerEmail Character(50) Customer Email

    Note that when you press the Save button GeneXus will ask the attribute definition for the

    CustomerAddress and the CustomerEmail. That is because the CustomerName and CustomerIdwere defined before.

    After you have added a new Customer object and inserted the attributes into the structure, theCustomer object will be created and its Structure and Forms will look as follows:

    Figure 15 Customer transaction structure

    Page 18 of 47

  • 8/12/2019 introduccion_genexus

    19/47

    Getting Started with GeneXus

    Figure 16 Customer transaction Win form

    Figure 17 Customer transaction Web form

    Step 9: Viewing Table Structure Changes

    By reviewing the Database (Step 7) after

    the Customer Object was created you cansee that GeneXus has automatically

    normalized the tables for you.

    You will see that GeneXus automatically

    moved the CustomerNm andCustomerAddress attributes from the

    Invoice table to the CustomerTable.

    Figure 18 Customer table structure

    Page 19 of 47

  • 8/12/2019 introduccion_genexus

    20/47

    Getting Started with GeneXus

    Figure 19 Invoice table structure

    The database structure is now the following:

    InvoiceId

    InvoiceDate

    CustomerId

    InvoiceId

    ItemId

    ItemDscItemPrice

    ItemQty

    CustomerId

    CustomerNm

    CustomerAddressCustomerEmail

    Step 10: Prototyping your Application in Visual Basic with MicrosoftAccess

    Note: Refer to the chapter: System Requirement / Generator Requirements / Visual Basic, tomake sure that you have all the software required to execute the application.

    You wont need an ODBC driver or a DBMS.

    1. Select Prototype.

    2. Choose Visual Basic to Prototype the two objects created

    so far: Invoice and Customer.

    Figure 20 Toolbar menu

    Figure 21 Model creation dialog box

    3. Click OK.

    Page 20 of 47

  • 8/12/2019 introduccion_genexus

    21/47

    Getting Started with GeneXus

    4. In the GeneXus Create

    Model Wizard that is

    displayed, type a name forthe model: Prototype Visual

    Basic.

    5. From the combination ofLanguages, User Interfaces,

    and different DBMSs, select

    Visual Basic with a Wininterface (the default one)

    and Accessas DBMS. Openeach drop-down menu to see

    the different possibilities.

    6. Click Next.

    Figure 22 Model creation wizard, Step 1

    7. In Step 2, select MicrosoftDataGrid 6.0 (OLEDB) in

    the Grid version drop

    down.

    8. Click Next.

    9. In Step 3, select the VisualBasic 6.0path.

    10. Click Next.

    Figure 23 Model creation wizard, Step 2

    Page 21 of 47

  • 8/12/2019 introduccion_genexus

    22/47

    Getting Started with GeneXus

    11. In Step 4, Click Finish.

    12. In the dialog box that isdisplayed, click OK.

    Figure 24 Database Creation Analysis dialog box

    Step 11: Viewing the Database Creation Report

    GeneXus displays a Database Creation Report to show you exactly what it is creating in the DB

    you specified in this case (Access) after viewing it. To do so, click Reorganize in the DatabaseCreation Reportdialog box.

    After you click this button, GeneXus will generate all the code to create the database. Then it willcompile the code so that you can execute the reorganization program.

    Figure 25 Database Creation Report

    Page 22 of 47

  • 8/12/2019 introduccion_genexus

    23/47

    Getting Started with GeneXus

    Step 12: Creating the Tables with the Database Manager

    At this stage GeneXus launches its Database Manager, a GeneXus-generated program, to createthe database, perform a data transfer (refactor the database when reorganizations are

    performed), rename tables, create indexes and update models.

    1. In the GeneXus Database Reorganizationdialog box, click Execute.

    The reorganization program is generated

    depending on your language selection in the

    GeneXus Create Model Wizard (Step 10).

    In this case the Database Manager isrunning a Visual Basic program to perform

    the tasks.

    2. Click Exit.

    Figure 26 Completed Database Reorganization

    Page 23 of 47

  • 8/12/2019 introduccion_genexus

    24/47

    Getting Started with GeneXus

    Step 13: Specify ing and Generating your Code

    After the Database has been created, you can have GeneXus specify your objects and generatethe programs in the language you selected (Visual Basic Code in this example).

    1. On the Buildmenu, click Build All. You can also click Build Allin the GeneXus toolbar.

    Figure 27 GeneXus toolbar

    2. Select the Type: Checkspecification and Other Options:

    Specify & Generate.

    Figure 28 Build All dialog box

    GeneXus presents you with a specification report for each program it will generate.

    The specification reports objective is to show you in a high level how the program will execute,which tables it will access and which operations it will perform.

    In this case you are viewing the specification report of the transactions; notice that transactions

    are programs that will enable the user to Insert, Update, and Delete functions on the database.It also ensures that referential integrity and record locking are handled.

    All this without you writing one line of code!

    Page 24 of 47

  • 8/12/2019 introduccion_genexus

    25/47

    Getting Started with GeneXus

    Figure 29 Navigation Report

    You will also notice that

    GeneXus adds new objects,called Selection List

    Figure 30 Selection list

    GeneXus automatically takes charge of referential integrity. That is, transactions have the

    necessary knowledge to avoid data inconsistency due to updates (for example, a parent with

    children has been deleted, or a child without a parent has been entered).

    However, an integrity check alone would not be enough because a check failure and a "Clientdoes not exist" message would not be useful for the user. It is necessary to help the user find

    the valid values!

    For this reason, GeneXus not only provides integrity controls, but also creates Prompt typeobjects that give the user a set of valid values to choose from.

    Although the Prompts are initially created by GeneXus, they can be modified by the user.

    Referential Integrity: It means

    that when you delete a

    customer from the CustomerTransaction, the program will

    check that there arent anyinvoices with that customer.

    Page 25 of 47

  • 8/12/2019 introduccion_genexus

    26/47

    Getting Started with GeneXus

    Step 14: Running your Application

    After the Database has beencreated and all your objects

    have been specified and

    generated, you can now launchVB and run your application to

    test it.

    1. Press F5, and click Executein the Execution dialog

    box.

    Figure 31 Execution dialog box

    2. In the Developer Menudialog box, click

    Transactions.

    3. Next, click Customer toenter new data.

    Figure 32 Developer menu options

    Page 26 of 47

  • 8/12/2019 introduccion_genexus

    27/47

    Getting Started with GeneXus

    4. Next, enter some data into the Invoice. You will notice a couple of things here:

    o The date automatically defaults once you tab over it.o If you tab over CustomerId you will get a system message: No matching Customer. BROWSE

    DATA? which was automatically created by GeneXus. If you click Yes, the correspondingprompt will appear. Also, if you press F4 on the Customer Id it will display a prompt list.

    o

    Formulas are automatically calculated when the values are entered.

    Step 15: Adding New Objects to your Project: Item Transaction

    Adding a new object called Item and reorganizing the Database is simple in GeneXus.

    1. Select Design in the drop-down menu of the GeneXus toolbar.

    2. Create the Item Transaction by following Steps 2 to 4. The following attributes will be insertedin the Item Transaction Structure:

    ATTRIBUTE TYPE DESCRIPTION

    ItemId --------- --------------------

    ItemDsc --------- --------------------

    ItemPrice --------- --------------------

    Note that when you press the Savebutton, GeneXus wont ask for the attribute definition of anyof them.

    Figure 33 Item transaction structure

    Page 27 of 47

  • 8/12/2019 introduccion_genexus

    28/47

    Getting Started with GeneXus

    3. Now click the Formand Web Form tabs to see the transactions windows and Web forms,

    respectively.

    Figure 34 Item transaction win form

    Figure 35 Item transaction web form

    Page 28 of 47

  • 8/12/2019 introduccion_genexus

    29/47

    Getting Started with GeneXus

    Step 16: Viewing Table Structure Changes

    After the Item object is saved, GeneXus will reorganize the tables again. The new database

    structure will be:

    InvoiceIdInvoiceDateCustomerId

    InvoiceIdItemIdItemQty

    CustomerIdCustomerNmCustomerAddress

    CustomerEmail

    ItemIdItemDscItemPrice

    Reviewing the Database after the Item Object has been created allows you to see that GeneXusautomatically normalizes the tables for you. You will see that GeneXus has automatically moved

    the ItemDsc and ItemPrice attributes from the Invoice1 (Invoice Detail) table to the Item Table.

    Figure 36 Impact Analysis Report

    Step 17: Impacting the Database

    Now we will go back to Prototype as we did in Step 10, and GeneXus will perform an Impact tothe application.

    1. Select Prototype in the drop-down menu of the GeneXus toolbar.

    You will see that GeneXus automatically moves the attributes from the InvoiceHeader to the Item.

    2. In the dialog box that is displayed, click OK.

    Page 29 of 47

  • 8/12/2019 introduccion_genexus

    30/47

    Getting Started with GeneXus

    3. In the Impact Analysis Report

    dialog box, click Reorganize.

    Figure 37 Impact Analysis Report

    Step 18: Refactoring the Data and Generating the Programs

    GeneXus will automaticallytransfer the data that was stored

    in the Invoice (Item data) to theItem Table.

    Figure 38 Database reorganization dialog box

    Page 30 of 47

  • 8/12/2019 introduccion_genexus

    31/47

    Getting Started with GeneXus

    1. On the Build menu, click

    Build\Specify or press SHIFT+ F8 to display the Select

    Object dialog box. Note thatonly the Item object will appear

    (if the Edited Onlycheckbox isselected). Click OK.

    Figure 39 Object selection dialog box

    2. In the Specify Objects dialogbox, select the Check

    specification option and clickOK.

    Figure 40 Object specification dialog box

    3. In the Specification Report

    dialog box, click Generate to

    generate the programassociated to the Item

    transaction.

    Figure 41 Specification Report dialog box

    Page 31 of 47

  • 8/12/2019 introduccion_genexus

    32/47

    Getting Started with GeneXus

    Step 19: Running your Application

    Now lets run the application again, to see how GeneXus moved the data from the InvoiceDetailfile to the Item file.

    1. Press F5, and then click Execute.

    2. Click the Item file in the Developer Menudialog box and click the Select button to seethe data you entered in the Invoice.

    This means that the reorganization programsnot only change the database structure, but also

    maintain the information stored in the database.

    Figure 42 Developer Menu dialog box

    Step 20: Creating a Report & Making a Call to It

    Now lets go back to GeneXus and create a quick report to print an invoice. We will create a reportin Prototype as no Database changes will be done; we will also call the report by adding a print

    button to the existing Invoice object.

    1. Follow Step 2 to

    create the new

    Report object, butthis time click on

    Report and typeInvoice in the

    Namefield.

    Figure 43 Object definition dialog box

    Page 32 of 47

  • 8/12/2019 introduccion_genexus

    33/47

    Getting Started with GeneXus

    2. Next, click Insert

    from Trn in the

    report wizard thatappears.

    Figure 44 Invoice Report Wizard, Step 1

    3. Choose Invoice, andclick OK.

    Figure 45 Object selection dialog box

    Page 33 of 47

  • 8/12/2019 introduccion_genexus

    34/47

    Getting Started with GeneXus

    4. Click Finishand the

    report Layout will

    appear.

    Figure 46 Invoice Report Wizard, Step 1

    The Layout tab contains the output to be printed later, and each one of them can have a set of

    controls such as attributes, variables, labels, etc.

    Figure 47 Invoice report

    Page 34 of 47

  • 8/12/2019 introduccion_genexus

    35/47

    Getting Started with GeneXus

    The navigation structure (which data is going to be listed, and in what order) is defined in theSource tab. To this end, a very simple procedural language is used.

    Figure 48 For each command

    In order to make the communication between the two objects we will make a call from the Invoice

    Transaction to the Invoice Report.

    5. Select the Rulestab.

    6. Write

    parm(InvoiceId);

    7. Click Save.

    Figure 49 Invoice report rule

    The FOR EACH command indicates that

    all the reports of a certain table will bequeried, showing the information

    indicated in the printing block(s). The

    FOR EACH command is used to definethe information to read in the database,

    but this is done by naming thecorresponding attributes, and you will

    NEVER have to specify from which tablesthis data will be obtained, or with what

    indexes.

    Page 35 of 47

  • 8/12/2019 introduccion_genexus

    36/47

    Getting Started with GeneXus

    8. On the Objectmenu,

    click Openand select

    the InvoiceTransaction.

    9. Next, click the Rules

    Tab.

    10.Type incall(RInvoice,

    InvoiceId) ifafter(TRN);

    Figure 50 More invoice report rules

    Note:After(TRN) is a GeneXus function; to read about it press CTRL + U, scroll to the bottom,

    highlight After(TRN) and hit the Helpbutton.

    Step 21: Specifying and Running your Application

    1. To Specify your Invoice, follow Step 13, to run your application follow Step 19.

    2. Click Invoice andenter some data,

    then click

    Confirm.After this your rule

    will be triggeredand your report

    will appear; your

    report can eitherbe displayed on

    the screen or sentto a printer.

    Figure 51 Destination selection

    Page 36 of 47

  • 8/12/2019 introduccion_genexus

    37/47

    Getting Started with GeneXus

    Figure 52 Invoice Report Viewer

    CONGRATULATIONS, you have successfully created an Invoice application in GeneXus; our nextstep is to show you how to move your application to another platform, .NET and/or JAVA.

    Page 37 of 47

  • 8/12/2019 introduccion_genexus

    38/47

    Getting Started with GeneXus

    How to Move your Application to .NET and JAVA

    Step 1: Deploy ing your Appl ication to .NET with Microsoft SQL Server

    Note: Refer to the chapter: System Requirement / Generator Requirements / .NET, and makesure that you have all the software required to execute the application

    Next we will deploy the application to .NET with a SQL DB.

    1. Select Design in the drop-down menu of the GeneXus toolbar.

    2. On the FileMenu, click NewModel to display the

    GeneXus Create ModelWizard.

    3. Name the model: Prototype.NET.

    4. Select .NET with a Web

    interface and SQLServeras the DBMS.

    5. Click Next.

    Figure 53 Create Model Wizard, Step 1

    6. In Step 2, select Driver and SQL Server

    7. Write the name of the Database and the Server. In the example, the Database name isdemo 5and the Server name is (local)

    8. Click Next.

    5The creation of the database is not performed by GeneXus when the creation process is carried out, so thedatabase must be created manually before GeneXus actually creates the database tables. Please refer toyour SQL Server manual for information on how to create the database.

    Page 38 of 47

  • 8/12/2019 introduccion_genexus

    39/47

    Getting Started with GeneXus

    9. In Step 3, select No on

    Use trusted connection.

    10.Enter the user id and

    password for the DBMSlogin. In the example the

    User Id is user_name

    6

    11.Select the SQL Server

    version.

    12.Click Next.

    Figure 54 Create Model Wizard, Step 3

    13.In Step 4, enter theCompiler and Virtual

    Directory paths and click

    Next.

    14.In Step 5, click Finish.

    Figure 55 Create Model Wizard, Step 4

    6The user needs CREATION rights to the database tables. For simplicity, we recommend assigning OWNERrights.

    Page 39 of 47

  • 8/12/2019 introduccion_genexus

    40/47

    Getting Started with GeneXus

    15.In the dialog box that is

    displayed, click OK.

    Figure 56 Model creation dialog box

    16.Follow Steps 11 and 12 to create the database.

    17.Open the Invoice Report. Select the Propertiesicon.

    Figure 57 Invoice report toolbar

    18.Select Only To Screen forthe Report output

    property under Options.

    19.Save the Report Invoice

    Object with the Savebutton or by pressing: CTRL

    + S.

    Figure 58 Report Properties dialog box

    Page 40 of 47

  • 8/12/2019 introduccion_genexus

    41/47

    Getting Started with GeneXus

    20.Follow Steps 13 and 14 tospecify and generate the

    code.

    21.Before executing it, compile

    the code with the Compilebutton.

    Figure 59 Application execution dialog box

    22.After compiling theapplication, Execute it by

    clicking the Execute button.

    23.Execute the Invoice

    Transaction.

    Note that the applicationsmenu will look like Fig. 60.

    Figure 60 Application menu

    Page 41 of 47

  • 8/12/2019 introduccion_genexus

    42/47

    Getting Started with GeneXus

    Step 2: Viewing the .NET Application Running

    Figure 61 Invoice

    Step 3: Deploy ing your Application to Java with Microsoft SQL Server

    Note: Refer to the chapter: System Requirement / Software Requirements / JAVA Generator, andmake sure that you have all the software required to execute the application.

    Next we will deploy the application to Java with a SQL DB.

    1. In the GeneXus toolbar, select Design.

    Page 42 of 47

  • 8/12/2019 introduccion_genexus

    43/47

    Getting Started with GeneXus

    2. On the File menu, clickNew Model to display the

    GeneXus Create ModelWizard.

    3. Name the model: PrototypeJAVA

    4. Select JAVA with a Web

    interface and SQLServeras the DBMS.

    5. Click Next.

    Figure 62 Create Model Wizard, Step 1

    6. In Step 2, enter theDatabase and Server name.

    In the example, the

    Database name is demo 7and the Server name is

    server-name.

    7. Click Next.

    Figure 63 Create Model Wizard, Step 2

    7The database is not created by GeneXus when the creation process is performed, so you must create thedatabase manually before GeneXus actually creates the database tables. Please refer to your SQL Servermanual for information on how to create the database.

    Page 43 of 47

  • 8/12/2019 introduccion_genexus

    44/47

    Getting Started with GeneXus

    8. In Step 3, enter the user id and password for the DBMS login. In the example the User Id is

    user_name 8

    9. Select the SQL Server version.

    10.Click Next.

    11.Enter the Servlet directory(the Servlet directory allows

    to specify the directorywhere the servlets

    generated will be

    transferred).In the example we use Resin

    and the Servlet directory is:C:\resin-2.1.7\doc\WEB-

    INF\classes.

    12.Enter the Static content

    base URL (indicates thedirectory where the servlet

    will search for the staticcontent -javascripts and

    images- used in the webobjects corresponding to it).

    13.Finally enter the Staticcontent directory seen

    from client, which indicatesthe directory to which we

    will transfer the javascripts -*.js files- generated.

    14.Click Next.

    Figure 64 Create Model Wizard, Step 4

    8The user needs CREATION rights to the database tables. For simplicity we recommend assigning OWNERrights.

    Page 44 of 47

  • 8/12/2019 introduccion_genexus

    45/47

    Getting Started with GeneXus

    15.In Step 5, enter the

    Compiler Path, the Make

    Path, the InterpreterPath, the Classpathand

    the Web Application BaseURL9

    16.Click Next, and then click

    Finish.

    17.Click OK.

    Figure 65 Create Model Wizard, Step 5

    18.Follow Steps 11 and 12 to create the database.

    19.Follow Steps 13 and 14 to specify and generate the code.

    Remember that before executing you must compile the code, with the Compilebutton

    Also remember to start the Servlet Server.

    20.Execute the JAVA application, and then the Invoice Transaction.

    More information about the JAVA Development Kits at:http://www.gxtechnical.com/main/hPSAmpInf.aspx?2,8,219,E,774,JAVA

    9In the example: Compiler Path= C:\Program Files\Microsoft SDK for Java 4.0\bin\jvc.exe Make Path= C:\Program Files\Microsoft SDK for Java 4.0\bin\nmake.exe Interpreter Path= C:\WINDOWS\system32\jview.exe Classpath = gxclassr.zip;.;C:\resin-2.1.7\lib\jsdk23.jar;C:\jdbc\sqlserver\Una2000.jar Web Application Base URL= http://localhost:8080/servlet/

    Page 45 of 47

    http://www.gxtechnical.com/main/hPSAmpInf.aspx?2,8,219,E,774,JAVAhttp://www.gxtechnical.com/main/hPSAmpInf.aspx?2,8,219,E,774,JAVA
  • 8/12/2019 introduccion_genexus

    46/47

    Getting Started with GeneXus

    Step 4: Viewing the JAVA Application Running

    Figure 66 Invoice

    Page 46 of 47

  • 8/12/2019 introduccion_genexus

    47/47

    Getting Started with GeneXus

    Online Resources

    GeneXus CommunityThe GeneXus Community provides a variety of ways to get answers to your questions, solutions to

    your problems, and to share your own expertise. Find the list of community resources available toyou at:www.genexus.com/community

    SupportARTech offers a wide range of support services and resources:

    Self-Service Online SupportThese resources are available to anyone online. However, the information that you access

    depends on your GXTechnical Access Level.

    Interactive Support Services

    Interact with other members of the Community and with our Support Team.www.genexus.com/support

    How to BuyThe GeneXus Technologies are sold through a network of distributors worldwide.

    Find a distributor near you at: www.genexus.com/distributors

    Otherwise, please contact [email protected]

    http://www.genexus.com/communityhttp://www.genexus.com/supporthttp://www.genexus.com/distributorsmailto:[email protected]:[email protected]://www.genexus.com/distributorshttp://www.genexus.com/supporthttp://www.genexus.com/community