Global formulas. Page1. Video filmed with GeneXus X Evolution 2

Similar documents
Configuring a Secure Access etrust SiteMinder Server Instance (NSM Procedure)

E: W: avinet.com.au. Air Maestro Training Guide Flight Records Module Page 1

Additional Boarding Setup and Daily Operations Guide

Passenger Rebooking - Decision Modeling Challenge

Stair Designer USER S GUIDE

Concur Travel User Guide

QuickStart Guide. Concur Premier: Travel

Concur Travel: View More Air Fares

e-crew Horizon Air Trip Trades Notes for the Flight Attendants

2017 PROCEDURES HAVE CHANGED READ CAREFULLY

Chapter 1. Draw Standard Departure Procedure

Specialty Cruises. 100% Tally and Strip Cruises

myldtravel USER GUIDE

ultimate traffic Live User Guide

Product information & MORE. Product Solutions

Daily Estimation of Passenger Flow in Large and Complicated Urban Railway Network. Shuichi Myojo. Railway Technical Research Institute, Tokyo, Japan

CruisePay Enhancements for 2005 Training Guide Version 1.0

e-crew Horizon Air Pilot Trip Trades Phase I Notes for the Crewmembers

Lesson: Total Time: Content: Question/answer:

ECLIPSE USER MANUAL AMXMAN REV 2. AUTOMETRIX, INC. PH: FX:

GUEST TRAVELER INVITATION PROCESS GUIDE. Follow these steps to invite a guest traveler to book in Orbitz for Business (OFB):

MAKING ONLINE RESERVATIONS ETEX GROUP TRAVEL ARRANGERS

WHAT S NEW in 7.9 RELEASE NOTES

Tool: Overbooking Ratio Step by Step

Online Guest Accommodation Booking System

PASSUR Aerospace. Departure Metering Program at Toronto Pearson International Airport. Training Manual

Part 1. Part 2. airports100.csv contains a list of 100 US airports.

Step-by-Step Guide: Itineraries and Per Diem

Model Solutions. ENGR 110: Test 2. 2 Oct, 2014

AirFrance KLM - FlightPrice

GetThere User Training

CASS & Airline User Manual

Hotel Booking System For Magento

FareStar Ticket Window Product Functionality Guide

Version 8.5 PENTAGON 2000 SOFTWARE. Flight Operations Module

To view a video tutorial, click here:

InHotel. Installation Guide Release version 1.5.0

AirFrance KLM - AirShopping

myidtravel Functional Description

Concur Travel: Post Ticket Change Using Sabre Automated Exchanges

Official Record Series 5

Aircraft Noise. Why Aircraft Noise Calculations? Aircraft Noise. SoundPLAN s Aircraft Noise Module

User Guide for E-Rez

Calculating Hose/Gun Capacity

1.- Introduction Pages Description 21.- Tutorial 22.- Technical support

EMC Unisphere 360 for VMAX

FlightMaps Online Help Guide FAQ V1.2

Specialty Cruises. A. 100% Tally and Strip Cruises

Frequently asked questions (FAQ)

PHY 133 Lab 6 - Conservation of Momentum

Angel Flight Information Database System AFIDS

CRISIS AIREP Guidance

Participation Conditions: Alcatel United Kingdom Operation - Europe Flight

How to Integrate CA SiteMinder with the Barracuda Web Application Firewall

COMMERCIAL LEVEL SIMULATIONS

Class F3K Hand Launch Gliders 5.7. CLASS F3K - HAND LAUNCH GLIDERS

Official Record Series 5

SENIOR CERTIFICATE EXAMINATIONS

Handling Transfers in Travel Booster

2018/09/01 05:24 1/1 Flight Plan

Be fast with fares. Be first with customers

TIMS to PowerSchool Transportation Data Import

NO FLIGHT EFFICIENCY USER MANUAL. Network Manager

e-airportslots Tutorial

DATA APPLICATION CATEGORY 25 FARE BY RULE

What if I just want to obtain flight schedules without making a reservation?

Q. Can I book personal travel on the site? - The Concur site is to be used exclusively for business related travel.

> Amadeus Single View

VAR-501-WECC-3 Power System Stabilizer. A. Introduction

United Kingdom Civil Aviation Authority

Preparing for International Travel

myldtravel USER GUIDE

The Official s Guide to Athletix

NEW AND IMPROVED. ROYAL CARIBBEAN Scope & Changes DEPOSITS AND FINAL PAYMENTS DEFINITIONS, SIZE REQUIREMENTS AND LIMITS

ANA Domestic Flight Online Business Travel Arrangement System. October 2017 All Nippon Airways Co., Ltd.

The American Express Airpoints Platinum Reserve Card Benefits Terms and Conditions.

Important! You need to print out the 2 page worksheet you find by clicking on this link and take it with you to your lab session.

Performance Indicator Horizontal Flight Efficiency

Copyright Thomson Financial Limited 2006

Request for Information No OHIO/INDIANA UAS CENTER AND TEST COMPLEX. COA and Range Management Web Application. WebUAS

SOMMAIRE WORK IN SAS MODE BORDEAUX OR ST NAZAIRE CAN TAKE 3 TABLES OF 4 AGENTS ONE LEADER PER TABLE 10. BOOK A CAR 1.

Unit Activity Answer Sheet

Travel: Making a Travel Reservation Purpose: The purpose of this guide is to assist the user in booking a trip in Concur s travel module.

Aircom User Guide. Version 2. Site Navigation Tips and Shortcuts Steps to Commission Search

PRAJWAL KHADGI Department of Industrial and Systems Engineering Northern Illinois University DeKalb, Illinois, USA

The System User Manual

Travel Agent - User Guide

DECISION NUMBER NINETEEN TO THE TREATY ON OPEN SKIES

Addendum to Model Implementation Conformance Statement for the IEC Ed2 interface in ABB 670 and 650 series version 2.2

Help Document for utsonmobile - Windows Phone

IPSOS / REUTERS POLL DATA Prepared by Ipsos Public Affairs

Concur Travel: Southwest Direct Connect

Concur Travel & Expense BOOKING TRAVEL VIA CONCUR

easycredit Integration Guide Version As of: About easycredit: General information about easycredit

Booking flights At the restaurant Wiki. Triggers. February 24, Grégoire Détrez Tutorial 4

FEES (PAYMENT SYSTEMS REGULATOR) INSTRUMENT (No 6) A. The Financial Conduct Authority makes this instrument in the exercise of:

Air India through Travelport Smartpoint

4 REPORTS. The Reports Tab. Nav Log

EASTERN MILES MEMBERSHIP TERMS AND CONDITIONS

Power Tong Torque Manual

Transcription:

Global formulas We often need for our application to make calculations that involve the values of certain attributes, constants and/or functions. For such cases, GeneXus provides us with its Formulas Page1

We have 2 possible ways to define formulas: Global formulas known in the whole Knowledge Base, And Local formulas, known only in the object in which they were defined. Let s start by learning what a Global formula is and how to define it. Page2

A global formula is a calculation we define in association with an attribute. We can see that the structures of transactions include a column under the title Formula. When we define a calculation for an attribute in this column, Page3

we are telling GeneXus that the attribute is virtual, meaning that it must not be created physically as a field in the associated table because the value of the attribute will be obtained by doing the calculation we indicate. Let s exemplify this: We will define a new attribute in the Flight transaction, to store the current discount applicable to each flight. We enter the attribute called FlightDiscountPercentage where its data type will be of a Percentage domain we define now, as a numeric with length 3. And we define another attribute, called FlightFinalPrice, which we will define as a formula to automatically calculate the current flight price in this attribute. Page4

In the formula column, we define the calculation: FlightPrice * (1 FlightDiscountPercentage/100) And press F5 to see what happens. We can see that only one field is created in the Flight physical table, even when we defined 2 new attributes in the structure of the Flight transaction. Page5

Because it has a definition in the formula column, this attribute is not added to the physical table. Because the attribute is defined in the Knowledge Base with an associated formula, GeneXus will know how to calculate its value, and the calculation will take place in all objects in which the attribute is present, with the result shown. We no reorganize Page6

The programs have been generated and here we see the application in runtime We execute the Flight transaction, and query Flight #1 where on the transaction form we can see the 2 new attributes we defined: Page7

the discount percentage, enabled for us to enter it, and the final price, disabled because it is the attribute we defined as formula, and its value is not entered but rather calculated and then displayed. Every attribute defined as Global formula will be reading data and we will not be able to type in any value for it. This is because the attribute gets its value from the associated calculation, which takes place every time that the attribute is used. Also, there is no field in the physical table to store the value of this attribute, so making it editable would make no sense. So we enter a 10 % discount for this flight. Page8

When we exit the field we can see that the formula is immediately executed Showing the flight s final price with the discount applied. Now let s get back to GeneXus. So far we have defined a Global formula attribute. Page9

Only attributes may be defined as Global formulas in the way we just described and using the formula column in the transaction. Something important to bear in mind is that even when in the example calculation we included only attributes of the transaction itself, it is possible to also include attributes of the extended table. Let s see that We create a transaction called Airline to record the airlines. We define 3 attributes for it: AirlineId, AirlineName, and AirlineDiscountPercentage, from the Percentage domain, to record the discount made by the airline for all its flights. We save, and now go to the Flight transaction, to assign to each flight the airline that operates it. Page10

We add the attribute AirlineId, which here will play the role of foreign key and change the value of its Nullable property to Yes. This allows us to not specify, in this first stage, the flight s airline, because we still don t have any airlines recorded. Further ahead we will come back to change the value of the Nullable property to No, to make specification of the airline mandatory when entering or modifying a flight. We add the attributes AirlineName and AirlineDiscountPercentage to view this data on the form: Page11

We now modify the definition of our formula, so that it calculates the flight s final price, applying to it the airline s generic discount instead of applying the flight s own discount. Then we press F5 Page12

We now see the proposal for creation of the Airline physical table, with the 3 attributes we defined, and for the foreign key AirlineId to be added to the Flight table. Let s now reorganize and execute Page13

We open the Airline transaction and add an airline called TAM, with a 30% discount: Now to this airline we will assign a flight. To flight N 1 we assign airline 1 Page14

and we will see that the flight s new final price has been calculated, as a Global formula attribute Page15

that includes the airline s discount percentage, which is an attribute of the extended table of the Flight base table. Something we haven t said yet is that formulas can assess conditions and the result may be calculated in different ways depending on whether such conditions are true or false. Let s see that: Page16

We click on this button with 3 dots to edit the formula more easily. We will define that the highest discount percentage be considered to calculate the flight s final price, so we get the best possible discount. Page17

With this definition, if the airline has a higher discount for all its flights than the flight s own discount percentage, for the calculation we will consider the airline discount. Otherwise, we use the flight s own discount percentage for the calculation. We then press F5. We execute the Flight transaction and to the first flight we will assign that its own discount percentage be greater than the airline s overall discount percentage, for example: 50%. Page18

We will see that the flight s final price was calculated upon considering the greater discount. Now let s get back to GeneXus. Page19

Formulas may contain several lines followed by IF and they might or might not contain a last line with the OTHERWISE Page20

for the case where none of the previous conditions apply. Also, even when in this example the way to obtain each result was through a calculation, we could also resort to functions applied to attributes or calculations such as Round to obtain a rounded result, or Month to get the month from a date, Page21

among other options... and we can also call a procedure we have defined, to return a value. We will now see another type of formulas which we will define also as global. We will create a second level in the Flight transaction and call it Seat. As the level s name indicates, we will use it to record the seats available on the flight and we will record, for each seat, whether it is window, aisle or middle. Then we will want to know, in all cases, the number of seats available on the flight. We type a period and fill in the attribute name: FlightSeatId Page22

We create another attribute called FlightSeat Location, and assign to it a Location domain of the character(1) type. We now go to the Domains node to modify a property in the domain we have just created. We find the Enum Values property Page23

and define the 3 values that the domain may have: Page24

Window and the value that will be stored when Window is selected will be the character W Middle where the value stored will be an M and Aisle where the value stored will be an A we then press OK, and save the definitions we made in the Flight transaction. Let s take a look at the form in this transaction: Page25

We can see that a grid was added to enter the flight seats, and for each seat, an indication can be made of its location through a combo control that provides the window middle or aisle values, which are possible values we defined for the domain of the FlightSeatLocation attribute. Prior to pressing F5, let s see something in the definition of the second level: Page26

If the key consists of FlightId plus FlightSeatId, for each flight we will not be able to repeat seat numbers. But we need the possibility of repeated numbers, plus a variable letter, since, in general seats are identified as 1A, 1B, etc. So we add a FlightSeatChar attribute, whose type we define as a SeatChar domain, character(1) and make the attribute part of the key Page27

to enable the record of equal seat numbers, with a different letter. We will restrict the possible letters from A to F, and for that we edit the domain. We find its Enum Values property and define the possible values: Page28

In this case, the values of descriptions match the values stored. Now, in order to know the number of passengers allowed on the flight, we will define a new attribute in the first level, as a formula, which will have the number of seats provided by the flight. We create the FlightCapacity, attribute, as numeric, 4: And in the column formula we write: Count, and make a reference, between parentheses, to an attribute in the second level, such as FlightSeatLocation: Page29

13.03 The attribute FlightCapacity will not be physically created in the FLIGHT table because its global formula, and it will always count the number of seats on the flight. We then press F5. And we will see that the Flight physical table SEAT is created, Page30

associated with the second level of the Flight transaction, with the attributes and key we have defined and the structure of the FLIGHT table will not be modified because the attribute FlightCapacity will not be physically created as expected. We agree, so we proceed. We execute the Flight transaction... query flight #1 and record some seats in it: 1A - window 1B middle 1C aisle 1D window 1E middle 1F aisle Page31

2A window and we leave it here.. We should note that the seat count is updated everytime that we add a seat to the flight Page32

Let s go back to GeneXus. We also have other formulas of the Count style that do operations with several records, such as Sum Page33

Page34

Average and others. The attribute referenced between parentheses in the formula provides GeneXus with information on the table to be navigated for doing the calculation. If GeneXus detects a relation between the navigated table and the location where the formula attribute is defined, it will only take into account the related records for the calculation In this example, where FlightId is present both where the formula is defined, and where the navigation takes place, so only the seats of the flight we are in are counted and not all the seats recorded on the table. Page35

If the relation is not found, then GeneXus will do the operation considering all the records in the navigated table. Also, we can count or add or average certain records that fulfill an explicit condition we have indicated. By way of example, if we want to count the number of window seats on the flight, to the formula we add, inside the parentheses, a comma and the corresponding condition Because the FlightSeatLocation attribute is from the Location domain and it has these 3 enumerated values defined the syntax to require the value that the attribute has taken is: domain name, dot, and name associated with the value we want to filter Page36

Press F5, w ego to Flight transaction, query flight #1 and we see that the formula attribute was counted and now shows: 3, which corresponds to the number of window seats, which matches the entries we made on the seat grid. Page37

Lastly, we must keep in mind that, just like all Global formulas, these could also have a triggering condition. That means that we can add an if at the end of the definition, with a specific assessment, for the formula to be triggered only if that condition is true. Page38