Tutorial Webdev 21
Tutorial Webdev 21
Tutorial Webdev 21
This documentation is not contractually binding. PC SOFT reserves the right to modify or delete
any topic dealt with in this document.
All product names or other trademarks mentioned in this publication are registered trademarks of their respective owners.
PC SOFT 2016: This publication may not be reproduced in part or in whole in any form without the express permission of PC SOFT.
Summary
Introduction
Preliminary points.................................................................................................................................................. 15
Overview of the tutorial.......................................................................................................................................... 15
How to access the online help?............................................................................................................................. 16
Legend of symbols.................................................................................................................................................18
If you are familiar with WEBDEV 20...................................................................................................................... 19
What is WEBDEV used for?.................................................................................................................................... 19
Summary 3
Summary
Summary 5
Summary
Summary 7
Summary
Summary 9
Summary
Part 12 - Appendices
Appendice 1. Vocabulary
Main terms used.................................................................................................................................................. 402
Summary 11
12
Summary
Conclusion
Summary 13
14
Summary
Introduction
Preliminary points
Caution: This manual is a tutorial. We advise you to check the online help when using WEBDEV.
The purpose of the tutorial is to help you discover WEBDEV, become familiar with the editors and
teach you the concepts of WEBDEV.
This manual does not cover all the features of WEBDEV.
You should plan on spending a few hours to follow this course and to learn WEBDEV: you'll find it
well worth it!
If you try to develop a site before following this tutorial, you will loose time, and a lot more than the
few hours you would have spent on this tutorial.
This tutorial was designed to be followed in two different ways:
either you follow all the detailed exercises in each lesson (recommended method).
or, if you are in a hurry and already experienced, you can read through it without doing the
exercises (all the exercises have screen shots). However, in order to quickly assimilate the
main concepts, we recommend that you follow the tutorial step by step.
WEBDEV evolving all the time, the screen shots found in this tutorial may differ from the windows
and pages displayed in your product.
Notes
Don't forget to also take a look at the examples supplied with WEBDEV: they are very instructive!
The tutorial may have evolved since this document was published. Don't hesitate
to check the online version of the tutorial ; the PDF file can be accessed from the
WEBDEV menu directly: on the "Home" pane, in the "Online help" group, expand
"Tutorial" and select "Tutorial (PDF)".
Introduction 15
16
Introduction
Notes
The online help of WINDEV, WEBDEV and WINDEV Mobile on Internet is available
from any computer equipped with an Internet access, without the product being
necessarily installed. This help is updated on a regular basis.
Each Web user can add comments about the documentation pages: personal
notes, examples, links..
Introduction 17
the content of the help: help common to WINDEV, WEBDEV and WINDEV Mobile or help
about the product currently used.
Legend of symbols
This symbol indicates the duration of the lesson. Please note that the actual time may
vary according to your level of experience.
An example is available to complement the lesson. The examples are available via the
home window of WEBDEV.
This symbol introduces a "Tip": we strongly advise you to read the associated text.
This symbol introduces a "Warning": reading the associated text is extremely important.
This symbol introduces a "Note": we recommend that you read the associated text.
This symbol presents a feature specific to Internet: we strongly advise you to read the
associated text.
18
Introduction
Introduction 19
20
Introduction
PART 1
Discovering
WEBDEV
22
Overview
WEBDEV is an IDE (Integrated Development Environment) targeted for Internet/Intranet
development: e-commerce, multimedia, ...
The developed sites can give access to information stored in the databases.
WEBDEV allows you to create:
static Internet/Intranet sites. These sites manage data that does not change (corporate sites,
sites available on a CD, ...).
dynamic Internet/Intranet sites, that manage data. The WEBDEV sites access all the databases,
relational or not, available on the market.
In this tutorial, you will learn how to create your sites (with or without database) and how to improve
them by using the features proposed by WEBDEV.
Starting WEBDEV
If you worked with an earlier WEBDEV version, this wizard allows you to retrieve the existing
configurations.
If you are a new user, this wizard allows you to configure your environment. This allows you to
choose the screen configuration used and to configure the Control Centers. See the online
help for more details.
If WEBDEV 21 was already started, identify yourself if necessary. The development
environment is started. The home window is displayed. This home window is used to:
create a project,
open an existing project,
open an example,
open one of the projects found in the tutorial.
24
Development environment
The editor
The development environment of WEBDEV includes a specific interface and several editors
allowing you to create the different elements of your applications.
For example, the page editor is used to create pages, the report editor is used to create reports, ...
All the editors are using the same environment:
1. Menu of editors, displayed in the shape of a ribbon (we'll see how to use it in the next paragraph).
2. Current editor (page editor here). This space allows you to view the element currently created or
modified in WYSIWYG (What You See Is What You Get).
3. Panes. The WEBDEV interface includes several horizontal and vertical panes allowing you to
quickly access different types of information.
Some examples:
The "Project explorer" pane (displayed on the right) is used to list all the project elements by
category.
The "Find - Replace" pane (displayed at the bottom) is used to quickly perform searches in your
project.
These panes can be hidden by pressing [CTRL] + [W] if necessary.
4. Bar of opened documents. This bar is used to quickly view all the opened elements. A simple
click on the button corresponding to the element displays it in its own editor.
The menu bar (ribbon) in details
The menu bar of WEBDEV is presented in the shape of a ribbon. This ribbon includes panes in
which the options of the editors are grouped.
We are going to take a closer look at the main elements of the ribbon, as well as how we will be
using it in this tutorial.
26
The different ribbon panes are used to access the options of the different editors for the current
project. Several types of panes are available:
the current pane: The tab of the pane appears in light gray and an orange line is displayed at the
top of the tab.
the popup panes, specific to the current element: The name of the pane is displayed in blue.
the available panes: The name of the pane is displayed in white.
The option area
The options displayed in the ribbon differ according to the selected pane. Several types of options
are available:
Options to check
Buttons to click
Button with arrow used to expand the options. Two types of buttons with arrow are available:
the buttons with arrow used to expand a menu
the buttons with arrow used either to expand a menu (click on the arrow), or to perform a
default action (click on the button icon).
The options are organized by group. Each group of options has a name and it can also include a
group button . This button is used to perform a specific action according to the current group:
displaying the description of the current element, displaying the help, ...
In this tutorial, to identify a menu option, we will be talking about panes and groups.
For example:
To display the help, on the "Home" pane, in the "Online help" group, click "Help".
WLanguage
WLanguage is the programming language common to WINDEV, WEBDEV and WINDEV Mobile.
If you are not familiar with this language, we advise you to follow the "Programming concepts"
lesson, page 410. This lesson presents the different types of variables, the main statements of
WLanguage, the processes of strings, numerics, dates, times, ...
development and
28
Principle of Browser/Server
How does it work?
An Internet or intranet site operates as follows:
The client (the Web user) is using a browser to access the site.
The browser sends a request to the server that is hosting the requested site. In this request, it
indicates the page that must be displayed and different parameters allowing the server to build
the corresponding page.
The server receives this request, processes it and returns the corresponding "HTML" page.
HTML(HyperText Markup Language) is the language used by all the browsers to display the Web
pages.
Therefore, there will be two types of processes:
Processes run at browser level, on the computer of the Web user.
Processes run at server level.
The code run at browser level is called JavaScript code. The browsers can only run JavaScript
code.
And in WEBDEV?
With WEBDEV, everything is developed:
in WYSIWYG ("What You See Is What You Get") in the editor: your pages are visually identical in
creation and at run time.
in WLanguage for the programming side.
WEBDEV converts your page created in the editor into HTML page that can be read by the browsers.
The server code is run in WLanguage.
The browser code is converted into JavaScript.
To create a site with WEBDEV, a single language is required: WLanguage.
However, two types of code are available: server code and browser code.
Why this distinction between server/browser? For performance reasons.
Indeed, between the browser and the server stands Internet, with its response time, latency...
Some simple operations can be performed on the browser directly, without having to go back to
the server.
INTERNET
Web user
HTTP requests
Web server
(Apache, IIS)
Server
Process the request
WEBDEV application
server
Databases
(HFSQL, MySQL,
Oracle, AS/400)
Practical example
To better understand the difference between the server processes and the browser
30
Tip
If the home window is not displayed, on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "WebDev concepts (Exercise)".
All the projects found in the tutorial are available from this menu.
Notes
Notes
Open the "PAGE_Registration" page in the editor: double-click its name in the project explorer.
The project explorer is used to display in the environment the list of all the
elements found in the project. These elements are grouped by theme: Pages,
Procedures, ...
To display the project explorer:
1.On the "Home" pane, in the "Environment" group, expand "Panes".
2.In the list of panes that is displayed, select "Project explorer".
This page contains edit controls and a "Register" button. The "Register" button must perform
two things:
1.Check that all the controls have been filled.
2.Save the values of controls in the database.
Notes
The code editor allows you to write the code of your processes.
The code editor presents the events associated with each control, which means
the events on which a specific process can be run.
Note: The processes are displayed in the order in which they will be run.
For example, the processes associated with the Button control are:
Initialization.
Browser click.
Server click.
Let's see the code displayed: the server code and the browser code are identified by different
colors:
The browser code, that will be run on the computer of the Web user, is displayed in green.
The server, that will be run on the server, is displayed in yellow.
32
In our example, all the input checks are performed in the green code (browser code). For example,
the EDT_LastName control must not be empty. The corresponding code is as follows:
// Check whether the "EDT_LastName" control is equal to
// an empty string (excluding spaces and punctuation)
IF EDT_LastName ~= "" THEN
// The control is empty, display an error message to the user
Error("Enter your name")
// Return in edit into the "EDT_LastName" control
// (without running the rest of code)
ReturnToCapture(EDT_LastName)
END
This check is performed in browser code because there is no need to go back to the server to
check that the controls are filled.
This is used to avoid useless round trips and to reduce the wait for the Web user: the navigation
is more fluid.
Once the browser code was run, the page sends the values entered to the server. Then, the server
runs the server code. In the server code, you have the ability to process the information received.
In our example, the information received is added into the database via the following code:
// Reset the customer structure
HReset(Customer)
// Retrieve the values of controls
// in the customer structure directly
ScreenToFile()
// Add the customer into the database
HAdd(Customer)
This operation cannot be performed in browser code because the database is common to all the
site users and therefore it is located on the server.
Close the code window (click the cross in the top right corner).
Close the page displayed in the editor (click the x in the top right corner).
Intranet/Extranet/Internet
Principles
An Intranet or Extranet site is often considered as being a management application in Web mode,
which means an application run in a browser.
This Web application can present:
business features intended for specific users,
processes that must be secured: not everyone should be able to access the application
The Web application can be accessed:
from a company network only, in which case we talk of Intranet site.
from Internet, in which case we talk of Extranet site.
In both cases, the Web application is secured via a management of logins, passwords, rights, ...
An Internet site is a site intended for "public" consumption (standard users or business users).
An Internet site must be easily found on the Web. Some examples: presentation site, e-commerce
site, ...
To bring Web users to your site, the site must be referenced by the search engines. In order for the
search engines to reference each page properly, an additional constraint appears: the site pages
must be directly accessible at any time. But this constraints is also a guarantee of simplicity for
the Web user: he can easily copy/paste a link from a page and re-use this link whenever required.
And in WEBDEV? (Classic/AWP, PHP, Static)
In WEBDEV, to develop an Intranet or Extranet site, the "classic" mode is more suitable because it
includes the following features: integrated security, automatic contexts.
Indeed, the classic mode includes automatic sessions. The session identifier is included in the
URL. Therefore, the address of pages depends on this identifier that changes at each connection.
Drawback: The search engines cannot index this site.
In WEBDEV, to develop an Internet site, you can choose one of the following modes:
The AWP mode (Active WEBDEV Page).
The PHP generation mode.
The static mode if your site contains preset pages only (no database).
34
Practical example
First, let's take a look at how the operating mode of an Internet page:
Tip
1.In the "WebDev_Concepts" project (that was opened at the beginning of this lesson), open the
"PAGE_Internet" page in the editor: double-click its name in the project explorer.
To quickly find a page in the current project, press [CTRL] + [E]. A window is
displayed, allowing you to perform a search on all the pages containing the set of
letters typed in the search area. All you have to do is select the requested page
and validate in order for this page to be opened in the editor.
1.Open the "Page_Home_of_Intranet_site" page in the editor: double-click its name in the
project explorer.
2.Let's check the page type:
On the "Page" pane, in the "Description" group, click "Description" (you can also select
"Description" from the popup menu of the page).
In the "General" tab, the page is defined as a dynamic page without generation in AWP
mode. This type of page is used in Intranet/Extranet mode.
3.Run the test of this page: click
among the quick access buttons.
4.The page is displayed in the browser.
5.See the address displayed in the browser. The URL has the following format: http://
localhost/WebDev_Concepts/CONNECT_MODETEST/<connection identifier>
where <Connection identifier> is a string that changes at each connection.
The address changes at each connection therefore the security is improved. However, this
behavior is not compatible with a referenceable site.
36
DESIGN
Use
Page templates
(based on ergonomics)
Import
Structure of the
database
(if necessary)
Import
Ergonomics
WEBDEV
styles
Analysis
Pages
WEBDEV project
WEBDEV development
Lesson 1.3. My
first pages
38
Overview
Notes
These examples will allow you to understand the operating mode of Internet/Intranet sites and will
allow you to handle your first database.
Opening the project
Start WEBDEV 21 (if not already done). Close (if necessary) the current project in order to
display the home window.
Important!
In this section, we will focus on the creation of simple pages. The "My_First_
Pages" project is an empty project that was created beforehand. The creation of
a project will be presented in another lesson.
Notes
To do so, in the home window, click "Tutorial" and select the "My first pages (Exercise)"
project.
A corrected project is available. This project contains the different pages created
in this lesson. To open the corrected project, on the "Home" pane, in the "Online
help" group, expand "Tutorial" and select "My first pages (Answer)".
2.The window for creating a new element is displayed. This window is used to create all the
elements that can be associated with a project.
3.Click "Page" then "Page". The wizard for page creation starts.
4.Select "Blank - Simple layout" and validate (green button at the bottom of the window). The
page is automatically created in the editor.
1.Click
among the quick access buttons (you can also use the CTRL S shortcut).
2.The backup window is displayed.
3.Enter the title of the page: "Form".
4.The name of the page (that will be used in programming) is automatically deduced from the
page title. If this name does not suit you, you have the ability to modify it and to specify a title
that differs from the name of the page.
5.Validate (green button).
40
Notes
For each page created in the editor, WEBDEV generates several types of files:
A "WWH" file that contains the description of the page for the page editor. This
file is saved in the project directory.
An "AWL" file that corresponds to the description of the page for the WEBDEV
engine in the EXE directory of the project.
An "HTM" file that contains the HTML code and the JavaScript code of the page
that will be sent to the browser. This file is saved in the "\<Project name>_WEB\
XX" sub-directory of the project directory (one sub-directory per language, for
example "FR" for French, "UK" for English,...).
(above "Edit").
Tip
You must create a control? Display the "Creation" pane of WEBDEV: all the
available controls are accessible in this pane.
1.Click the control (simple click): the caption becomes editable. If you prefer to use the
keyboard, all you have to do is press the [SPACE] key or the [ENTER] key to switch the caption to
edit.
Notes
2.Type "Name" and press the [ENTER] key to validate. The caption is immediately modified.
The name of the control is also modified: it appears in the tooltip when the control is hovered
by the mouse cursor: EDT_Name.
Study the name of the control proposed by WEBDEV: this name starts with the
letters "EDT_". This prefix is automatically added because the project is using a
programming charter.
The programming charter is used to define a prefix for each type of object,
allowing you to quickly identify the element:
a page starts with "PAGE_" (we saw it when we saved the page).
an edit control starts with "EDT_".
a button starts with "BTN_", etc.
If you do not want to use this charter, all you have to do is disable it: in the ribbon,
on the "Project" pane, in the "Other actions" group, expand "Charter" and uncheck
"Use the charter".
A simple modification was made on the edit control: change its caption.
42
To modify the detailed characteristics of the control, all you have to do is double-click the
control. A description window of the control is displayed:
We are going to modify the maximum input size: all you have to do is type the new size (30 in
our case) in the "Max input size" control. Several other characteristics can be modified. To
save the modifications, click the green validation button.
Now, it's your turn. Use the same method to create the following edit controls, below the
"Name" control:
Caption
Type
Size
First name
Text
30
Address
Multi-line text
Text
255
Login
Text
10
Password
Password
10
You may have noticed that these controls do not have the same type. To modify the type of the edit
control, display the description window of the control.
44
This allows you to increase the width of the different page controls.
Notes
1.Select the "Name" control then all the edit controls found in the page (keep the [CTRL] key
down while clicking the different controls)
Caution: the first selected control is important. Indeed, the alignment options are
based on:
The size of the first selected control: it will be used as reference for the size of
the other controls.
The position of the first selected control: all the selected controls will be aligned
in relation to the first selected control.
2.Display the "Alignment" pane of the WEBDEV menu. This pane contains all the alignment
options available for the controls.
Notes
3.We want the left and right sides of the controls to be aligned. Click "Justified (Ins. and Out.)".
If you don't know which alignment to choose, hover the different options
proposed by the "Alignment" pane of WEBDEV. When an option is hovered by
the mouse cursor, the controls selected in the page are automatically positioned
according to the hovered option.
If the positioning suits you, all you have to do is click the option.
If the positioning does not suit you, all you have to do is click in the page: the
controls are moved back to their initial position.
46
among the quick access buttons (or use the CTRL S shortcut).
Notes
This style can be added to the style sheet of the project in order to be re-used. To
do so, you must:
1.Click the "Add this style to the project" button in the "WEBDEV style" pane
displayed on the right of the description window.
2.Give a name to the style.
3.Click the "Add" button.
Notes
48
The [F4] key is used to apply the last modifications performed to the selected
controls. In our case, the change of color is automatically applied to the
"Password" control.
1.In the ribbon, on the "Page" pane, in the "Edit" group, expand "Other actions" and select
"Generate a file description".
2.A new editor appears: the data model editor. The data model editor contains the description
of all the data files that will be used by the project.
3.The wizard for generating a data file is started.
4.The name of the data file is automatically filled with the name of the page. We are now
going to modify some elements:
Type "Registration" in the name.
Type "Registration" in the caption.
Type "a registration" in the last control.
50
5.Go to the next step (yellow arrow at the bottom of the wizard).
6.Choose the controls to retrieve. In our case, all the page controls correspond to an item.
Notes
9.In this example, the "Name" item will be a key with duplicates and the "Login" item will be
a unique key. Therefore, the file can contain two people with the same name but not with the
same login.
Let's go back to the registration form in order to add the data entered by the Web user into
the data file. The document bar is found at the bottom of the editor. In this bar, a button is
displayed for each document opened in the editor.
52
A button is required to save the data from our form. This button will be used to validate the
information entered in the page and to save the data in the Registration file.
1.Display the popup menu of the control and select "Code" (or press the [F2] key).
2.The processes associated with the button are displayed. The yellow codes correspond to
the processes performed on the server and the green codes correspond to the processes
performed on the browser.
3.We want to save the data in the database. The access to the database can be performed in
Server code only: therefore, the code must be entered in the Server click code (yellow).
4.Enter the following code:
PageToFile()
HAdd(Registration)
Info("Record added.")
1.In the ribbon, on the "Tools" pane, in the "Database" group, click "WDMap".
2.Select the "Registration" file. The content of the data file is displayed.
54
Go back (if necessary) to the "PAGE_Form" page by clicking its name in the bar of opened
documents.
1.Double-click the "Name" control: the description window of the control is displayed.
2.Display the "Details" pane.
3.Check "Mandatory input". If this option is checked, WEBDEV will automatically check that
this edit control was filled.
4.Validate the description window.
Create a new edit control: you can for example copy/paste the "Password" control found in
the page. The caption of this control is "Check" and its type is "Password".
The code for checking the password must be entered in the processes associated with the
"Save" button.
1.Click the "Save" button and press the [F2] key.
2.This check consists in comparing the value typed in the "Password" control and the one
typed in the "Check" control. The server is not required to perform this check: it can be
performed locally in the browser.
56
3.Therefore, we are going to enter the following code in the browser "Click" process:
IF EDT_Password<>EDT_Check THEN
Info("Error, the passwords are different.")
EDT_Password = ""
EDT_Check = ""
ReturnToCapture(EDT_Password)
END
1.Click
among the quick access buttons.
2.The window for creating a new element is displayed: click "Page" then "Page". The wizard for
page creation starts.
3.Select "Blank" and validate.
1.Click
among the quick access buttons (you can also use the CTRL S shortcut).
2.The backup window is displayed.
3.Enter the title of the page: "Login".
4.Validate.
Notes
58
The type of the "Password" control must be "Password". To modify the type of the
edit control, display the description window of the control.
Now let's see the operating mode of buttons. First, let's take a look at the "Register" button.
Notes
For the "Connect" button, we must enter the WLanguage code required to perform the search:
1.Select the "Connect" button and display the associated processes ([F2] key).
2.Enter the following code in the "Click (server)" process:
HReadSeekFirst(Registration,Login,EDT_Login)
IF NOT HFound(Registration) THEN
Error("Login not found.")
ELSE
IF EDT_Password = Registration.Password THEN
Info("OK, you're connected.")
ELSE
Error("Wrong password.")
END
END
60
Notes
4.Save (CTRL S) and close the code editor (x at the top right).
Test of the page
Conclusion
By creating two pages only, we have discovered several features of WEBDEV:
the creation of controls: edit controls and buttons,
the possibilities for aligning and organizing the controls in the page,
the addition of records into data files,
the sequence of pages,
the search for record in the data files,
the use of server code and browser code.
...
After this overview, we will go into more details in the next section, especially regarding the analysis
and the definition of the database characteristics before explaining how to develop a full site.
62
PART 2
My first
database
64
66
and the
databases
This lesson will teach you the following concepts...
Vocabulary used.
The different modes for accessing the databases.
Overview
You may have to handle data when creating an application. To store the data, you must create a
"database".
In WEBDEV, when creating a project that is using data, an "analysis" must be created beforehand.
An "analysis" contains the description of data files (or tables). The application data will be saved
in the data files.
Notes
When running the application, these descriptions will be used to create the database and/or the
data files. The information will be stored in this database or in these data files.
Several tools for performing maintenance operations on the HFSQL databases
are supplied with WEBDEV. They can be accessed from the HFSQL Control Center.
WEBDEV supports most of the database formats (nearly all of them). The most common formats
are:
HFSQL, the database system supplied in standard with WEBDEV. The HFSQL database is
available in Classic mode or in Client/Server mode.
AS/400, Access, Sybase, Informix, ...
Oracle, SQL Server, MySQL, xBase, ...
Any database accessible in SQL language in Windows.
Text (ASCII files).
Several methods (also called "access modes") can be used to access the data:
Native Access,
OLE DB access,
Direct ODBC access,
ODBC access via OLE DB.
68
HFSQL
HFSQL is a database that is very powerful, very fast and very reliable.
HFSQL operates in Windows and Linux, on mobile devices (iOS, Android, Windows), on networks of
any size and type, and it automatically manages hundreds of concurrent accesses.
HFSQL is available in Classic version and in Client/Server version.
HFSQL can be freely distributed with your WEBDEV sites.
HFSQL proposes all the features of a database, especially:
the log process,
the transactions,
the replication,
the triggers,
the stored procedures,
the clusters, ...
See the online help for more details about implementing these features.
In the different sections of this tutorial, we will be using a HFSQL Classic database then a HFSQL
Client/Server database.
Caution !
An access via OLE DB is an access that is using a multi-database access standard. This type of
access is based on MDAC (Microsoft Data Access Component).
If you are using an OLE DB access, MDAC must necessarily be installed on the
user computers (version 2.6 or later).
Some databases may not be accessible via this method. Check whether an OLE DB driver exists
before using this type of access.
The SQL* and HRead* functions of WLanguage can be used with this type of access.
ODBC access via OLE DB
In summary, it is a "mix" of OLE DB and ODBC. This is the "heaviest" method and the least efficient
one in term of performance. It should not be used on small databases.
The SQL* and HRead* functions of WLanguage can be used with this type of access.
70
and analysis
Overview
To create a site with a database, you must:
Create the project linked to the site. This project will group all the site elements (pages, codes,
queries, reports, ...).
Create the analysis linked to the project. The analysis is used to describe all the data files handled by the site.
Notes
1.Start WEBDEV (if not already done). Close the current project if necessary.
2.In the home window, click the "Create a project" button and select "Web site". The wizard for
project creation starts. The different wizard steps help you create your project. The information
specified in this wizard can be modified later.
Tip: To create a project, you can also:
among the quick access buttons of the WEBDEV menu.
1.Click
2.The window for creating a new element is displayed: click "Project".
3.First, the wizard allows you to enter the name of the project, its location and its description.
In our case, this project will be named "My_WebDev_Site"
Notes
4.By default, WEBDEV proposes to create this project in the "\My Sites\My_WebDev_Site"
directory. You can keep this location or modify it via the [...] button.
72
When you develop for the Web, avoid using accented characters in the names of
elements (projects, pages, ...).
Notes
For the project summary, type "The purpose of the project is to manage products".
5.The different wizard sections are indicated in the left margin. You can easily go from a
section to another one by clicking on it. The other steps of the "Description" part being not
fundamental, click "Charters" directly.
6.This section is used to define the different charters associated with the project. For the
programming charter, don't modify the suggested options. Go to the next step via the "Next"
arrow found at the bottom.
7.This step is used to define the style book (also called "Skin"). The style book is used to
define the "look" of the site.
The skins are used to standardize the visual aspect of a site and they allow you
to easily change style.
The skin provides the images, the fonts, the texture, the shape of buttons and
the styles available for the project.
Select "Evolution".
8.We are now going to specify the information regarding the database. Click "Database"
directly.
Notes
9.Select "Yes, create a new database" and validate. The wizard for analysis creation starts.
To better understand the lessons found in this section and to optimize your
training, we advise you to create the "My_WebDev_Site" project.
A corrected example can be accessed at any time to check the validity of the
operations performed.
To open this corrected project, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "My WebDev site (Answer)".
1.Specify the name and directory of the analysis. By default, the name of the analysis
corresponds to the name of the project and the analysis directory is a ".ana" directory in the
project directory. We will keep these default parameters. Go to the next wizard step.
2.You now have the ability to choose the types of databases used by the project. Select
HFSQL Classic (the database proposed by default with WEBDEV).
74
To create the data files of this analysis, we will be using the different methods proposed by
WEBDEV.
The steps of the wizard for creating a data file are as follows:
1.In the wizard, select "Select a description among the preset data files". Go to the next wizard
step (arrow at the bottom of wizard).
2.The list of preset data files is displayed. We are going to create the "Customer" file. In the
list of data files, select "Customer". Go to the next step.
3.The wizard proposes the list of items to include in Customer file. This list is very impressive
because it is used to manage several types of Customer files.
4.Click "None" to deselect all the items. Then, check the following items: CustomerID,
Company, LastName, FirstName, Address, ZipCode, City, StateDep, Country, Phone, Cell,
Email.
5.Go to the next wizard step.
76
6.Validate the wizard. The "Customer" file is automatically created in the data model editor.
7.The window for creating a new element is displayed. We are now going to create the data file
containing the orders.
Creating a data file: creating the file and the items
To create a data file from the window for creating a new element:
Notes
You also have the ability to create a data file from the data model editor: on the
"Analysis" pane, in the "Creation" group, click "New file".
4.We are going to create the "Orders" file. Enter its name ("Orders") in the wizard. This name
will be used:
to handle the data file by programming. The variable associated with the file will be "Orders".
to build the name of the associated physical data file ("Orders.fic" file).
Notes
The caption and description of the elements represented by the file records are automatically
displayed.
In the wizard, the control "A record represents" is used to get an understandable
caption during the description of the links between data files. A caption is
automatically proposed from the name of the file.
In our case, type "An order".
Notes
5.In the "Automatic identifier" area, keep "Automatic identifier on 8 bytes". If an automatic
identifier is defined on the data file, it means that the data file includes a unique key,
automatically managed by WEBDEV.
To create the identifier (an identifier is a unique key), you have the ability to
create a numeric item whose type is "Automatic identifier".
This identifier is automatically managed by WEBDEV. Whenever a record is added
into the data file, WEBDEV automatically assigns a value to the identifier of the
file. This value is unique.
6.Go to the next step and select the type of database associated with the data file. We are
going to work on HFSQL Classic data files. Go to the next step.
7.Click the green button to validate. The data file is automatically created in the analysis. The
description window of items is opened.
78
We are going to create the items of the "Orders" file. In the description window of the data file, you
will notice that an item was automatically created: "OrdersID". This item corresponds to the
automatic identifier of the data file. This item includes the name of the file and the letters "ID".
We are going to create the other items of this data file.
First, we are going to create the "Date" item. This item will contain the order date
1.In the description window of items, double-click in the "Name" column of the first empty row.
This column automatically becomes editable. Type "Date".
2.Click the "Caption" column. The name of the item is automatically displayed. We are going
to modify the caption of the item by clicking on it: type "Order date". In the "Type" column, the
"Text" type is automatically selected. Expand the list and select the "Date" type.
Notes
3.This item will be a key item (an index) in our data file: the keys are used to improve the
speed for accessing the data and for the sorts.
For a database in SQL format, the engine is using the indexes at the best.
For a sequential browse of a data file, all you have to do is specify the browse index (which
means the key).
4.The definition of the key is performed as follows: re-select the line of the "Date" item to
enable the description controls found on the right of the screen. Then, all you have to do is
specify the type of key used. In our case, the date is a key with duplicates.
5.You must also define the search direction of the key. The search direction is used to define
the default sort for this item. In our case, when a browse is performed on this key, the default
sort order will be "ascending".
We are now going to create the "Status" item that is used to find out the status of the order.
The information entered here will be automatically used when creating the pages linked to
the data file. You find here the control type and the caption.
We are going to enter the different options corresponding to the status of the order in the
"Content" tab:
Click the "Content" tab.
The option 1 corresponds to Pending. Type "Pending" in the edit control found on the right of
number 1.
Type "Validated" in the edit control found on the right of number 2.
Click the "+" button to add a new option in the radio button.
Type "Canceled" instead of "Option 3".
80
Notes
Another method will be used to create the "PaymentMode" file that contains the characteristics of
the payment: importing a CSV file.
A CSV file is a text file that is using a specific format. This file contains data on
each line. The data is separated by a separation character (a comma, a semicolon or a tab in most cases).
From the CSV file containing the data, WEBDEV will create:
the description of the data file in the analysis,
the HFSQL data file with the data found in the CSV file.
Tip
1.On the "Analysis" pane, in the "Creation" group, expand "Import" and select "Import the
descriptions of files/tables".
To import a CSV file (or any other file) into the analysis, you also have the ability
to Drag and Drop the CSV file (from the Windows file explorer) to the data model
editor. This will be presented in the next paragraph.
82
8.Don't forget to check "The first row contains the names of the columns".
9.Go to the next step.
10.The structure of the data file that will be created is displayed. Keep the default options. Go
to the next step.
11.The content of the CSV file will be automatically converted to HFSQL format. The wizard
proposes to create the HFSQL file in the project directory. Keep the proposed options and go to
the next step.
1.Select the "PaymentMode" file then select "Description of data file" from the popup menu.
2.In the window that is displayed, modify the caption of the file: delete "(Imported)".
to display the description of the items found in the data file.
3.Click
4.This data file contains no automatic identifier and no unique key. We are going to switch the
"Code" item to unique key:
Position the selection bar on the "Code" item if necessary.
In the right section of the screen, click "Unique key".
84
6.Validate the description window of items then the description window of the file.
Direct import of existing data files
The last method for creating data files consists in importing the existing HFSQL data files. This
method will be used to create the "Product" file.
Caution!
1.In the file explorer of Windows, open the following WEBDEV sub-directory:
"\Tutorial\Exercices\My_WebDev_Site".
2.Select the "Product.fic" file.
3.Drag and Drop the "Product" file to the data model editor of WEBDEV.
4.The import wizard starts. Validate the different screens. The data file appears in the data
model editor.
All the necessary data files are now found in the data model editor.
Only the description of the "Product" file was imported into the analysis of our
project. The data found in the "Product" file was not imported into the project.
To handle the data found in the file that was just imported, copy (in the file
explorer) the "Product.fic", "Product.mmo" and "Product.ndx" files (found in the "\
Tutorial\Exercises\My_WebDev_Site") to the EXE sub-directory of the directory of
your project.
Note: To directly open the file explorer on the directory of your project, on the
"Home" pane, in the "General" group, click .
We are now going to create the links between the data files. A link is used to define the integrity
constraints (cardinalities) between two data files.
Let's create the link between the "Customer" file and the "Orders" file: a customer can have
86
Notes
You also have the ability to directly enter the cardinalities of the link in the wizard.
5.Go to the next step. The wizard automatically proposes the key used by the link (CustomerID).
6.Display the next wizard screen. The wizard proposes to create the "CustomerID" key in the
Orders file to store the customer corresponding to the order.
8.This screen is used to define the integrity rules that will be automatically applied. In our
case, you have the ability to choose the requested behavior when deleting a customer as well
as the requested behavior when modifying the customer identifier.
9.Validate the integrity rules by going to the next screen.
10.Click the green arrow. The link is automatically created in the data model editor.
Similarly, create a link between the "PaymentMode" file and the "Orders" file. These two files
are linked as follows:
An order must have a payment mode.
A payment mode can be used in several orders.
In the wizard:
The cardinalities are as follows: PaymentMode (0,n), Orders (1,1)
The link key corresponds to the "Code" item.
We are now going to create a link between the "Orders" file and the "Product" file. This link will
be used to create a link file, the file of order lines.
1.Similarly, create the link between the files.
2.Answer the questions asked by the wizard:
Each Order has at least one Product: No
Each Order can have several Products: Yes
Each Product has at least one Order: No
Each Product can have several Orders: Yes
3.Go to the next step. The wizard proposes to create a relation file. Keep "Create the relation
file automatically" and go to the next step.
88
4.The wizard proposes the unique key of the Orders file: "OrdersID". Go to the next step.
5.Validate the creation of the key by going to the next step.
6.Keep the default options regarding the integrity rules and go to the next step.
7.The wizard proposes the unique key of the Product file. Select "Reference". Go to the next
step.
8.Validate the creation of the key by going to the next step.
9.Keep the default options regarding the integrity rules and go to the next step.
10.Click the green arrow. The relation file is automatically created in the data model editor.
We are now going to modify the relation file that was created by WEBDEV. Indeed, this file will
contain the order lines.
We are going to:
Modify the name of the file.
Modify the name of its items.
Add items to find out the quantity of products ordered and the total of the order line.
First, we are going to rename the file. A similar operation was already performed when the
caption of the imported file was modified. However, it is a little bit more complex in this case:
we are also going to rename the physical file linked to the file description.
1.Select the "Orders_Product" file. Select "Description of data file" from the popup menu.
2.In the window that is displayed, modify:
the name of the file: "OrderLine".
the name on disk: "OrderLine".
We are now going to modify the items of this relation file.
1.Click
Notes
2.This file includes 3 items. Position the selection bar on the "OrdersID_Reference" item. This
item is a composite key.
A composite key is a set of items that constitute an index.
This type of key is used to browse the data file according to complex criteria
or to perform specific searches on several items at the same time.
90
We are now going to add 3 new items into this relation file: Quantity, TotalBT and TotalIOT.
1.Position on a new row and create the "Quantity" item. This item is a "Numeric" item.
2.Position on a new table row and create the "TotalIOT" item. This item is a "Currency" item.
3.A window is displayed, indicating that the item already exists in the analysis and proposing
to re-use its characteristics:
7.Validate the description of items (green button at the bottom of the screen) and the
description of the file.
1.In the data model editor, on the "Analysis" pane, in the "Analysis" group, click "Generation".
2.The analysis generation is automatically started.
The descriptions of the data files found in the analysis have been modified.
To update the data files of the application, WEBDEV proposes to synchronize the structure of
the deployed data (also called "modification procedure of data files"). This operation is used
to update the data files (".fic" files) according to their description in the analysis.
92
The wizard for automatic modification starts. Validate the different screens until you reach
The wizard proposes to save the existing data files, don't change anything and go to the next
step.
The wizard proposes to enter the passwords for protecting the data files modified by the
automatic modification. Keep the default options and go to the next step.
The list of data files to modify is displayed. Validate the wizard.
The data files are updated.
94
PART 3
Intranet site
with data
96
Notes
The parts 3, 4 and 5 of this tutorial will allow us to develop a site for order management that is
using data files in HFSQL Classic format.
In part 3, we are going to develop the Intranet section of the site. This Intranet site will be used to
view, enter and modify products. This site is a dynamic WEBDEV site.
Referencing
In a dynamic WEBDEV site, only the home page of the site can be referenced.
The referencing of a WEBDEV site is presented in Lesson 5.6. The referencing,
page 253.
Part 4 will allow us to develop the Internet section of the site. You will have the ability to list the
new products and to view their details.
Part 5 will allow us to continue the development of the site, by proposing the following features:
Printing reports,
Managing the use levels,
Sending emails,
Managing the multilingual feature.
...
The development of this site will also allow us to talk about site deployment in part 6. You will see
the main points for developing a WEBDEV project.
The creation of the project and analysis was presented in the previous section. We won't go back
to it. We are going to work with a project that already contains an analysis and pre-filled data files.
The analysis of the site is an improved version of the analysis that was created in the previous
part.
98
The site that we are going to develop being quite long (it is a full site that will allow us to discover
the main features of WEBDEV), several intermediate projects are available:
A project used to perform the operations in part 3.
A project used to start the operations in part 5 (this project includes all the operations performed in parts 3 and 4).
A final project used to start the operations in part 6 (this project includes all the operations performed in parts 3, 4 and 5).
The different projects that can be opened are listed at the beginning of each lesson as well
as the operations that must be performed to open them.
100
site
102
Browser
WEBDEV application
server
Time
WEBDEV session
The Web user connects to a
dynamic WEBDEV site
CONTEXT
- Return Page 2
- Return Page N
CONTEXT
CONTEXT
CONTEXT
CONTEXT
- Return Page 1
CONTEXT
for addition
and modification
This lesson will teach you the following concepts...
Creating a dynamic page used to list the products.
Creating a dynamic page whose type is product form.
Managing the addition and modification of a product
104
Overview
We are going to create the different pages of the dynamic WEBDEV site used to list, add and
modify products. These operations will allow you to discover:
how to use WEBDEV for creating dynamic pages,
how to access the database.
These operations will also allow you to use some very useful features of WEBDEV.
Answers
1.Close (if necessary) the current project in order to display the home window.
2.In the home window, click "Tutorial" and select "Full WebDev Site (Exercise)".
A corrected project is available. This project contains the different windows
created in this lesson. To open the corrected project, on the "Home" pane, in the
"Online help" group, expand "Tutorial" and select "Full WebDev site (With pages)".
1.Click
among the quick access buttons (or use the CTRL N shortcut).
2.The window for creating a new element is displayed: click "Page" then "Page".
3.The wizard for creating a new page is displayed.
Notes
4.In the list of preset templates, select "Simple" then, in the list on the right, select the "Menu"
template: it is a template with a header at the top, a menu and the page body below.
A preset template is used to group part of the interface and processes in a single
location.
We recommend that you use templates to re-use and standardize the interface
of your sites.
Notes
By default, this page contains the different controls used to view the presentation
possibilities. In our case, we are going to delete these controls:
1.Select the controls found in the page (press the [CTRL] + A keys).
106
Notes
In the editor, by default, only the page controls are accessible. You cannot edit
the controls and the template processes. By using the CTRL A shortcut, only the
page controls are selected. The controls of the page template are not modified.
6.Validate.
Creating the controls
Notes
To create the list of products, we are going to use a Looper control. This control will be linked to the
"Product" data file.
1.On the "Creation" pane, in the "Data" group, expand "Looper" and select "Looper"
2.Click in the top left corner of the page, just below the menu: the wizard for creating the
Looper control starts.
3.The wizard asks how to fill the Looper control:
by programming (this feature will be presented in a forthcoming lesson),
from the database, from a data file or from a query,
from a WLanguage variable.
In this case, the Looper control must display all the products: select "Display the data coming
from a file or from a query".
4.Go to the next step by clicking the arrow at the bottom of the screen.
5.The next wizard screen proposes the different data files and the queries found in the current
project. Expand "Analysis" if necessary and select the "Product" file.
108
8.Then, the wizard proposes to select the search key, which means the default sort for the
data displayed in the Looper control. The items proposed in the wizard correspond to the items
defined as key items in the analysis. The products will be sorted according to their caption.
10.Validate the wizard. The Looper control is automatically created in the page.
Let's take a look at the control that was just created: the data is already displayed in the control,
even in the editor.
This concept is called "Live data": the content of the data files found on the development
computer is used in the windows or reports handled in the editor. This feature is very useful to
define the size of the controls found in a page for example.
We are going to hide the control containing the product identifier. Why hide it instead of
deleting it? Because this identifier will be used later in our development.
1.Select the "STC_ProductID" control. This control corresponds to the identifier (control with a
number at the top of the looper).
2.Display the description window of the control ("Description" from the popup menu).
3.In the "GUI" tab, uncheck "Visible".
4.Validate the description window of the control.
We are now going to modify the menu of our page in order to display the option used to list
the products. The menu is found in the page template. Therefore, we are going to modify the
page template.
1.Display the popup menu of the menu (right mouse click) and select "Open the template".
110
Notes
4.Display the description window of the option (select "Option description" from the popup
menu).
5.In the "General" tab:
Enter the caption of the option: replace "Option 1" by "List of products".
In the "Action" combo box, select the action "Display the PAGE_List_of_products page".
Validate the description window of the option.
6.Press the [ESC] key to exit from the edit mode.
We have modified the menu displayed in the template. You also have the ability
to modify other template elements such as the logo or the "Company name"
caption.
Notes
112
We are going to run the test of the page that was just created.
1.Click
among the quick access buttons.
2.The page is automatically displayed in the browser.
3.You have the ability to scroll the products with the page scrollbar.
1.Press the [F2] key. The code editor displays the different processes of the page.
2.Enter the following code in the "Global declarations" process:
PROCEDURE MyPage(gnProductID is int on 8 bytes)
114
1.Display the "Analysis" pane if necessary: on the "Home" pane, in the "Environment" group,
expand "Panes" and select "Analysis". The different data files described in the "Full_WebDev_
Site" analysis are displayed in the pane.
2.Click the arrow on the left of the "Product" file: the items found in the data file are listed.
3.With the mouse, select all the items displayed in the pane (except for the "ProductID" item).
You can for example use the mouse lasso or the multi-selection by keeping the [CTRL] key
down.
4.Drag and Drop these items to the page that was just created.
5.Different controls are automatically created in the page. These controls are linked to the
corresponding item in the data file. To check this:
Select the "Reference" control for example.
Display the popup menu (right mouse click) and select "Reference".
Display the "Link" tab of the description window:
This tab is used to see that the current edit control is linked to the "Reference" item found in
the "Product" data file.
6.Close the description window.
7.Save the page (CTRL S).
116
Reposition the controls in the page in order to get the following interface:
Enlarge the Image control used to view the image associated with the product.
We are now going to align the edit controls in the page and to give them the same size:
1.Select the "Description" control then all the edit controls found in the page (keep the [CTRL]
key down while clicking the different controls). The first selected control will be used as reference
for the size of the other controls.
2.Display the "Alignment" pane of the WEBDEV menu. This pane contains all the alignment
options available for the controls.
3.We want the outside and inside borders of the controls to be aligned. Click "Justify (Ins. and
Out.)".
1.Press the [F2] key. The code editor displays the different processes of the page.
2.In the "Global declarations" process, enter the following code after the code that was
written beforehand:
HReadSeekFirst(Product,ProductID,gnProductID)
IF HFound(Product) = False THEN
// Display the list of products
PageDisplay(PAGE_List_of_products)
END
FileToPage()
1.On the "Creation" pane, in the "Usual controls" group, click "Button".
2.Click below the edit controls to create the button.
3.Modify the caption of the button (press the [SPACE] key to edit the caption): the new caption
is "Cancel".
118
1.Select the button and press the [F2] key. The processes associated with the button are
displayed.
2.Enter the following code in the server click code of the button:
PageDisplay(PreviousPage())
Notes
Validate button
1.On the "Creation" pane, in the "Usual controls" group, click "Button".
2.Then, click on the left of the "Cancel" button to create the button.
3.Modify the caption of the button: the new caption is "Validate".
1.Select the "Validate" button and press the [F2] key. The processes associated with the button
are displayed.
2.Enter the following check code in the browser click code of the button:
IF EDT_Reference ~= "" THEN
Error("Enter a reference.")
ReturnToCapture(EDT_Reference)
END
IF EDT_Caption ~= "" THEN
Error("Enter a caption.")
ReturnToCapture(EDT_Caption)
END
IF EDT_Description ~= "" THEN
Error("Enter a description.")
ReturnToCapture(EDT_Description)
END
IF EDT_PriceBT = 0 THEN
Error("Enter a price.")
ReturnToCapture(EDT_PriceBT)
END
120
Our page is using less than 10 controls and the benefit is already there; think of the pages
containing a lot more controls: a single code line performs all the assignments!
HModify is used to update the data found in the data file for the current record.
PageDisplay is used to display another page. in our case, the "PAGE_List_of_products" page
is redisplayed.
or CTRL S).
6.Save the modifications (
7.Close the code window.
Managing the product image
Notes
The upload consists in copying a file from the client computer to the server.
On the contrary, the download consists in copying a file from the server to the
client computer.
Notes
In the Product file, an item is used store the image associated with the product.
The Image control is already found in our page, allowing us to see the image, but we are going to
give the Web user the ability to change the image associated with the product.
To do so, we are going to allow the Web user to upload an image file found on his computer and to
associate it with the item found in the data file. We will be using an Upload control.
WEBDEV proposes to manage the file upload via two specific controls:
an Upload control used to upload a single file,
an Upload control used to upload several files.
In this example, the user will upload a single file at a time, therefore we will be
using the single-file Upload control.
1.On the "Creation" pane, in the "Usual controls" group, expand "Button". The list of preset
buttons is displayed.
2.Select "Send a single file".
3.Click the position where the control must be created in the page (below the Image control
for example).
1.Display the code of the "Send" button: select the control and press the [F2] key.
2.Different processes are associated with the Upload control. We are going to modify the
"Receiving the uploaded files" process to copy the image into the data directory of the site.
3.Enter the following code in the "Receiving the uploaded files" process:
Notes
This code is using "...". These 3 dots are used to go to the next line in a code line.
They are used here for layout purposes.
In the code editor, you have the ability to delete them and to use a single code
line.
122
Notes
fSep allows you to retrieve the separator that will be used on the operating system of the
server ("\" for Windows, "/" for Linux). Therefore, your site is independent of the server on
which it is installed!
Then, the uploaded image is displayed in the IMG_Visual Image control.
5.When typing and saving the code, the gsImagePath variable is displayed in red and a
compilation error occurs in the error pane: "Error: The identifier gsImagePath is unknown or
inaccessible". Indeed, this global variable was not declared.
6.To declare the global variable:
Display the code for declaring the global variables of the page (for example, in the code
editor, on the "Code" pane, in the combo box that lists all the processes, select the "Global
declarations" process).
Our image can now be uploaded on the server. All you have to do now is save the image in the
database.
modification link:
1.Position on the "List of products" page: click the "PAGE_List_of_products" button found in the
button bar:
2.On the "Creation" pane, in the "Usual controls" group, click "Link".
3.Then, click in the Looper control to create the link (at the bottom right for example).
124
4.Modify the caption of the link (press the [SPACE] key to edit the caption): the new caption is
"Modify".
The "Modify" link must open the "PAGE_Product_form" page. We are going to open this page
by programming.
1.Select the "Modify" link and display the associated processes ([F2] key).
2.In the code window that is displayed, enter the following code in the "Click" process:
Notes
PageDisplay(PAGE_Product_form,ATT_ProductID[LOOP_Product])
Try the assisted code input: as soon as you type the opening bracket "(", a popup
list is displayed, proposing the name of all the pages found in the project. All you
have to do is select the page with the keyboard or mouse.
If you do not find the name of the requested page in the list, it means that this
one was not saved beforehand.
Notes
By default, ATT_ProductID returns the value of the attribute for the row that was
clicked. The code can be written even more simply:
PageDisplay(PAGE_Product_form,ATT_ProductID)
or CTRL S).
The different elements used to manage the modification of a product have been implemented, we
are now going to run a test to check that everything is operating properly.
Notes
126
by the code:
PROCEDURE MyPage(gnProductID is int on 8 bytes = -1)
5.We must now manage the value "-1" (when adding a record). Replace the following code:
HReadSeekFirst(Product,ProductID,gnProductID)
IF HFound(Product) = False THEN
// Display the list of products
PageDisplay(PAGE_List_of_products)
END
FileToPage()
by the code:
IF gnProductID = -1 THEN
HRESET(Product)
ELSE
HReadSeekFirst(Product,ProductID,gnProductID)
IF HFound(Product) = False THEN
// Display the list of products
PageDisplay(PAGE_List_of_products)
END
END
FileToPage()
We are now going to modify the page menu to give the user the ability to add a new product.
1.Position on the "List of products" page: click the "PAGE_List_of_products" button found in the
button bar.
2.Display the popup menu of a button and select "Open the template".
3.Select the menu.
4.Click "Option 2". A yellow border appears around the menu. This yellow border indicates that
the menu is in "Edit" mode: it can be modified.
128
5.Display the description window of the option ("Option description" from the popup menu).
6.In the "General" tab:
Enter the caption of the option: replace "Option 2" by "Add a product".
In the Action area, select the action "Display the PAGE_Produt_form page".
7.Validate. The menu option appears:
This page signals to the user that a duplicate was found: the reference (that is a unique key)
is identical for two products.. This page is used to modify the value of the reference (displayed
in a red area): enter "REF-338" for example.
This page is one of the pages for automatic management of HFSQL errors.
130
Notes
Several errors may occur when adding or modifying a record: duplicate error,
integrity error, password error, ...
WEBDEV proposes several modes for managing these errors:
the automatic mode: a specific page is displayed to the user whenever an
error occurs when managing the database records. This page allows the
user to modify his data directly.
the advanced programmed mode: a custom procedure or page for error
management is called whenever an error occurs when managing the
database records.
The "WW_Auto_Management_Errors" example, supplied withe WEBDEV, is used
to check these different modes for error management. This example can be
opened via the home window of WEBDEV ("Open an example" option).
132
PART 4
Internet site
with data
134
Notes
In this part, we will be using the project that was developed in part 3: we are going to create an
Internet section in the Intranet site. The Internet section will be used to list the new products and
to view their details.
This section will be created in AWP mode (Active WEBDEV Page).
Referencing
In a WEBDEV AWP site, all the site pages can be referenced.
Part 5 will allow us to continue the development of the site, by proposing the following features:
Printing reports,
Managing the use levels,
Sending emails,
Managing the multilingual feature.
...
The development of this site will also allow us to talk about site deployment in part 6.
Reminder: We are going to work on a project already associated with an analysis and containing
data files filled beforehand. Let's see the analysis used:
136
Caution!
If you have followed part 3 of this tutorial, the operations of part 4 are performed in the same
example.
If you did not follow part 3 of this tutorial, you will not be able to perform the
operation used to link the Internet and Intranet section of the site (Linking the
Internet site and the Intranet site, page 163).
138
140
WEBDEV application
server
Browser
Time
The Web user connects to
an AWP site
CONTEXT
CONTEXT
CONTEXT
142
pages
Overview
We are going to create the different AWP pages used to list, add and modify new products. These
operations will allow you to discover several topics regarding the management of data files and
they will also allow you to use some features of the AWP mode.
If the "Full WebDev Site" exercise was not opened in the previous lesson:
Answers
1.Close (if necessary) the current project in order to display the home window.
2.In the home window, click "Tutorial" and select "Full WebDev Site (Exercise)".
A corrected project is available. This project contains the different pages created
in this lesson. To open the corrected project, on the "Home" pane, in the "Online
help" group, expand "Tutorial" and select "Full WebDev site (Answer)".
144
2.The new page is displayed in the editor, with controls proposed by default. Delete these
controls:
Select the controls found in the page (press the [CTRL] + A keys).
Delete the controls ([DEL] key]).
among the quick access buttons.
3.Save the page: click
4.In the window that is displayed, specify the title of the page: "List of new products".
5.Validate to save the "PAGE_List_of_new_products" page.
1.Display the description window of the page: display the popup menu and select "Description".
2.Check "Generation in AWP mode (without automatic context)".
3.Validate.
4.Save the modifications by clicking
1.On the "Creation" pane, in the "Data" group, expand "Looper" and select "Looper". The control
currently created follows the movement of the mouse.
2.Click the top left corner of the page: the wizard for creating the Looper control starts.
3.In the wizard, select "I want to fill the looper by programming". Go to the next step by clicking
the arrow at the bottom of the screen.
4.In the next step, we are going to select additional parameters for creating the Looper
control:
The Looper control is in Classic mode: the entire data will be displayed during the page
load.
Select the "Classic" operating mode.
The Looper control is using an unlimited number of rows. Indeed, all the products must
accessible in the page directly. The page will be enlarged order to display all the products.
Type 0 in the "Maximum number of rows in a page" control.
The Looper control will display the new products on 5 columns.
In the "Number of columns" area, replace 1 by 5.
Keep the proposed display direction.
146
Reduce the width of the main cell in order for the 5 cells to fit across the page width.
We are now going to create the different controls that will be displayed in the Looper control.
Each row will display:
An Image control used to display the image of the product.
A Link control used to display the name of the product and to open the detailed form.
A Static control used to store the identifier of the product.
We are going to create these different controls and program the fill operation for the Looper
control.
1.On the "Creation" pane, in the "Usual controls" group, click "Image". The control currently
created appears under the mouse.
2.Hover the first row: a green border appears, allowing you to view the available area.
3.Click the top left corner of the first row found in the Looper control. The Image control is
created.
4.Display the description of the Image control to modify the characteristics of the control
(double-click the control).
5.Modify:
the name of the control: IMG_Visual.
the type of the image: "From a database: memo (medium speed)". Indeed, the image of the
product is stored in memo format in an item of the Product data file.
the display mode of the image: "Homothetic centered" with "High-quality display" checked.
6.Validate.
1.On the "Creation" pane, in the "Usual controls" group, click "Link".
2.Click in the Looper control (below the image) in order to create the link.
3.Display the description of the Link control to modify its characteristics (double-click the
control).
4.This control is named "LINK_View_Product".
5.Validate the description window of the control.
6.Select the Link control and increase its width (with the handles) so that it occupies the
width of the row.
148
1.On the "Creation" pane, in the "Usual controls" group, expand "Text" and select "Simple static".
2.Click in the Looper control (on the right of the image) to create the static control.
Notes
3.Display the description of the Static control to modify its characteristics (double-click the
control).
4.This control is named "STC_Product".
5.Validate the description window of the control.
To fill the controls found in the looper and to modify their characteristics on each row, we are going
to create attributes.
A Looper control includes:
controls, that are repeated on each row.
attributes. An attribute is used to define the characteristic of the control that
will be modified on each row. For example, if the value and the color of the
PRICE control must change on each row, you will have to define two different
attributes for the same control.
1.Display the description window of the Looper control (double-click the control).
2.In the top section of the window, a single attribute is created by default. We are going to
define 3 attributes (one for each control found in the looper).
3.Modify the attribute created by default:
Rename the attribute to "ATT_Image".
Select the "IMG_Visual" control.
Select the "Value" property. Indeed, the value of the image will be modified on each row.
1.Display the processes associated with the page (click in the page and select "Code" from the
popup menu or press the [F2] key).
2.Enter the following code in the initialization code of the page:
FOR EACH Product WHERE NewProduct = True
LooperAddLine(LOOP_NewProducts,Product.Visual,...
Product.Caption,Product.ProductID)
END
150
LooperAddLine is used to add a new row into the Looper control. The attributes of the row
are updated with the data of the current record:
the value of the "ATT_Image" attribute corresponds to the image found in the "Visual" item of
the "Product" file.
the caption of the "ATT_Link" attribute has for value the content of the "Caption" item found
in the "Product" file.
the caption of the "ATT_ID" attribute has for value the content of the "ProductID" item found
in the "Product" file.
or CTRL S).
4.Save the modifications (
5.Close the code window.
We are going to run the test of the page that was just created.
1.Click
among the quick access buttons.
2.The page is automatically displayed in the browser.
Like the page used to list new products, this page must be generated in AWP mode:
1.Display the description window of the page (select "Description" from the popup menu).
2.Check "Generation in AWP mode (without automatic context)".
3.Validate.
4.Save the modifications (
152
or CTRL S).
1.Press the [F2] key. The code editor displays the different processes of the page.
2.Enter the following code in the "Global declarations" process:
PROCEDURE MyPage(gnProductID is int on 8 bytes)
1.On the "Creation" pane, in the "Usual controls" group, click "Image".
2.Click in the page (top left corner for example).
Notes
3.Display the description of the Image control to modify the characteristics of the control
(double-click the control).
This control is named "IMG_Product_Image".
Its type is "From a database: memo (medium speed)".
The display mode: "Homothetic centered without enlargement".
With the "Homothetic centered without enlargement" display mode, the size
of the image will homothetically adapt to the area defined for the image. The
proportions will be respected and the image will not be enlarged.
To create the simple Static control used to display the caption of the product:
Notes
1.On the "Creation" pane, in the "Usual controls" group, expand "Text" and select "Simple static".
2.Click in the page (on the right of the image for example).
154
To simplify the positioning of controls, press the [F7] key. A press on this key is
used to see the area occupied by the control, a second press on this key is used
to display an outline around the control (in edit only).
This allows you to view the border of the control and to easily position the controls
in relation to the other ones.
This feature is very useful for the controls without border.
We are going to display the product description in a rich Static control (called Rich Text Area).
1.On the "Creation" pane, in the "Usual controls" group, expand "Text" and select "Formatted
display control".
2.Click in the page, below the product description: the control is automatically created.
1.Display the description window of the control that was just created: double-click the control
for example.
2.In the "General" tab:
Modify the name of the control: "FSTC_Price",
Delete the caption.
Modify the type of control: select "Currency".
3.Validate.
Create a simple Static control to display the reference of the product. This control is named
"STC_Reference" and its caption is "Reference". This control is positioned below the price.
All the necessary controls have been created. We are now going to associate each control with the
corresponding item. This association is performed in the "Link" tab of the description window of
the control.
156
4.In the "Linked item" area, expand "Analysis" then expand "Product". The list of items found
in the Product data file is displayed.
5.Select the "Visual" item of the "Product" data file.
1.Press the [F2] key. The code editor displays the different processes of the page.
2.In the "Global declarations" process, enter the following code after the code that was
written beforehand:
HReadSeekFirst(Product,ProductID,gnProductID)
IF HFound(Product) THEN
FileToScreen()
END
HFound is used to check whether a record was actually found. This function is mainly
required for the multi-user sites. It is used to avoid errors caused by the deletions performed
by the other users.
FileToScreen is used to display in the controls the data found in the data file, for the current
record. In our case, the current record corresponds to the record found by HReadSeekFirst.
4.Close the code editor.
Displaying the form from the list of products
Now, let's see how to display the form of the product selected in the list of products. The principle
is straightforward: the user will select the product in the Looper control and he will display the
details via a link. This link already exists in the looper.
First, we are going to modify the "PAGE_List_of_new_products" page in order for the link to
5.In the window that is displayed, you can see the name of the parameter that was declared
in the "Global declarations" process of the page (gnProductID). All you have to do is select the
control containing the value of the parameter. In our case, the product identifier is found in the
"ATT_ID" attribute.
6.Select "ATT_ID" and validate.
158
Notes
Caution: In a looper, the value is not contained in the control but in the attribute
that is associated with it for the characteristic of the value.
Notes
To improve our page, we are going to modify the styles of the controls. If you are working with
a graphic designer or if a style book was defined for your site (style book of the company for
example), the styles have been defined in a CSS style sheet. We are going to import this style
sheet into our WEBDEV project in order to use these styles.
Notes
Reminder: You have the ability to choose a skin when creating the site. The skins
are used to standardize the visual aspect of a site and they allow you to easily
change style.
The skin provides the images, the fonts, the texture, the shape of buttons and
the styles available for the project.
You create sites with a professional style from the styles supplied in standard.
Importing CSS styles is used for example to add a new style found on Internet.
1.In the ribbon, on the "Project" pane, in the "Project" group, expand "Import" and select "A CSS
style sheet".
2.The import wizard starts and proposes two options:
Import the CSS styles: This option imports the CSS styles into the WEBDEV project. Then,
the styles can be modified in WEBDEV.
Use an external CSS style sheet: This option allows you to use an existing style sheet. This
option must be chosen when a style sheet is defined for a company and when it must be
shared between several sites (style book of the company).
3.Select "Import the CSS styles into WEBDEV" and click the yellow arrow.
4.Select the "customstyles.css" file. This file is found in the "\Tutorial\Exercises\Full_WebDev_
Site" directory. The different styles found in the style sheet are displayed.
160
Tip
The "class-" prefix means that it is a CSS class. This attribute means that this style will be
applied to the elements with the HTML "class" attribute.
5.Keep all the proposed styles and validate. The styles are imported and they are available in
WEBDEV.
Apply the CSS styles
We are now going to apply the different styles to the controls found in the "PAGE_Product_details"
page.
1.Position on the "PAGE_Product_details" page.
2.Display the description window of the "FSTC_Price" control that displays the price of the
product (double-click the control).
3.In the "Style" tab:
Select the "Display area (CSS)" element.
Select the "class-styleprice" style in the "CSS style" list:
162
Caution!
We are now going to link these pages by proposing, from the Internet pages, a "Management" link
used to access the Intranet pages.
To do so, we are going to modify the template of the Internet pages.
The following operations can be performed only if you have followed part 3 of this
tutorial regarding the creation of Intranet pages.
Tip
1.Display the processes associated with the Link control ([F2] on the control).
2.Enter the following code in the browser click code:
DynamicSiteDisplay("Full_WebDev_Site")
3.In this code, DynamicSiteDisplay is used to display the first dynamic page of the project (in
our case, it will be the "PAGE_List_of_Products" page).
4.Close the code editor.
5.In the orange bar of the template, click
to propagate the template modifications to all
the pages that use this template.
6.In our case, the two AWP pages of the project are proposed. Validate the window for
updating the template.
7.Close the page template.
We are now going to modify the "PAGE_List_of_Products" page so that it can be opened by
DynamicSiteDisplay:
1.Display the "PAGE_List_of_Products" page in the editor.
2.Display the description window (select "Description" from the popup menu).
3.In the "Advanced" tab, check "Allow the access by DynamicSiteDisplay()".
4.Validate.
164
We are now going to run the test of the project via the AWP pages.
1.Position on the "List of new products" page.
2.Click
among the quick access buttons.
3.The page is automatically displayed in the browser.
4.Click the "Management" link. The page for managing the products is displayed.
1.In the ribbon, on the "Creation" pane, in the "Usual controls" group, expand "Text" and select
"Rich Text Area".
2.Click in the page (top left corner for example). The control is automatically created.
166
This type of control automatically adapts its height to its content. We are going to define a
specific width:
1.Select the control that was just created.
2.Increase the width of the control (with the handles) until it occupies the entire page width.
Now, we are going to display the general sales conditions in this control. The file containing
6.Try the different options: all the options available for the text are available in the ribbon.
7.Click
among the quick access buttons.
8.The page is automatically displayed in the browser.
Conclusion
The last two parts have allowed us to see the specific features of an Intranet site and the ones of
an Internet site.
In the next part, we will present several topics that can be included in an Internet site and in an
Intranet site:
Multicriteria search,
Print,
Management of multilingual feature, ...
168
PART 5
Let's continue
the development
170
search
Overview
In the previous parts, we have created a WEBDEV project used to develop a site containing both
an Internet section and an Intranet section.
We will still be working with the "Full_WebDev_Site" project that was used in parts 3 and 4.
If the "Full_WebDev_Site" project was not opened in the previous lesson:
Answers
1.Close (if necessary) the current project in order to display the home window.
2.In the home window, click "Tutorial" and select "Full WebDev site (With pages)".
A corrected project is available. This project contains the different pages created
in this lesson. To open the corrected project, on the "Home" pane, in the "Online
help" group, expand "Tutorial" and select "Full WebDev site".
In this lesson, we will give the user the ability to perform a multicriteria search.
In our example, this search will be performed on the "Orders" file. The user will be able to select:
the name of the customer,
the status of the order,
the payment mode,
the price of the order.
The interface of the "PAGE_Multicriteria_search" page will be as follows:
172
Notes
1.Click
among the quick access buttons. The window for creating a new element is
displayed: click "Query". The wizard for query creation starts.
2.Select "Select".
Indeed, the query that will be created will allow us to select records. Go to the next step.
3.The description window of the query is displayed.
To build the query, we are going to select the elements that will be displayed in the result.
1.Double-click the items found in the analysis on the left of the description window. The items
taken into account are displayed in the middle of the screen.
We want to display:
the information regarding the order. In the "Orders" file, double-click the items: OrdersID,
Date, Status and TotalIOT.
the information regarding the customer who placed the order. In the "Customer" file, doubleclick the "FullName" item.
the information regarding the payment mode of the order. In the "PaymentMode" file, doubleclick the "Caption" and "PaymentModeID" items.
174
In the window that is displayed, specify an ascending sort on the item and validate.
3.A red arrow with the number 01 appears on the right of the "Orders.Date" item. This arrow
indicates that an ascending order is performed on this item. The number "01" indicates that
this sort will be performed first.
4.Give a name to the query: enter "QRY_FindOrders" instead of "QRY_NoName1" in the "Query
name" area:
5.Validate the description window of the query (green button at the bottom of the screen).
6.The graphic representation of the query is displayed:
176
Notes
1.Click
.
2.The result is displayed in a window:
A popup menu is displayed when a right click is performed on the result of the
query. You have the ability to export the result to:
an XLS file (Excel).
an XML file (eXtensible Markup Language).
a text file.
3.The result lists ALL the orders. In our case, we want to display the orders corresponding to
the search criteria only. To do so, we must use a query with parameters.
4.Close the window.
To define the query's parameters, display the description window of the query: double-click
the background of the graphic representation of the query (or use the popup menu, "Query
description" option).
Notes
Select "Contains".
Check "the parameter".
Specify the name of the parameter: "pCustomerName".
We advise you prefix the parameters of queries with the letter "p". Therefore, you
will be able to easily find them in the code editor.
When searching for a query parameter, all you have to do is type 'p' and the
completion feature of the code editor will propose all the parameters.
4.Validate the description window of the condition. The number "1" appears on the right of the
"Customer.FullName" item, indicating that a selection condition was defined.
178
Notes
The query description in natural language (at the bottom of the query editor) is
automatically updated according to the added condition.
We are now going to define a condition on the payment mode. The "PaymentMode.
PaymentModeID" item must not be displayed in the result of the query but a condition must
be applied to it. To do so, it will be made invisible.
1.To avoid displaying the "PaymentMode.PaymentModeID" item in the result:
Click the eye (
) corresponding to the "PaymentMode.PaymentModeID" item in the list of
query elements (in the middle of the screen).
In the menu that is displayed, select "Don't display".
2.To define a selection condition on the "PaymentMode.PaymentModeID" item:
Select the "PaymentMode.PaymentModeID" item (in the middle of the screen).
Expand the "Selection condition" button and select "New condition".
In the window that is displayed, specify that the selection condition corresponds to a
parameter:
Select "Is equal to".
Select "the parameter".
Specify the name of the parameter: "pPaymentModeID".
3.Validate the definition of the selection condition.
The last selection condition to define affects the amount of the order. In fact, we are going to
define two selection conditions in order to specify a minimum price and a maximum price.
1.Select the "Orders.TotalIOT" item in the list of query elements.
2.Display the popup menu of the item (right mouse click) and select "Selection condition ..
New condition".
3.In the window that is displayed:
Select the condition "Is greater than or equal to".
Click "the parameter".
Specify the name of the parameter, "pMinPrice".
4.Validate the definition of the selection condition.
5.Define another condition on the same "Orders.TotalIOT" item: display the popup menu of
the item (right click) and select "Selection condition .. New condition".
6.In the window that is displayed:
Select the condition "Is less than or equal to".
Click "the parameter".
Specify the name of the parameter, "pMaxPrice".
7.Validate the definition of the selection condition.
180
Notes
The definition of the two selection conditions on the item (is greater than or
equal to and is less than or equal to) can be replaced by a single condition "Is
included between".
However, the use of a selection condition such as "Is included between" means
that the two values must be entered (which is not the case if two different
conditions are defined).
8.Validate the description window of the query. The query graph is modified to take into
account the selection conditions that have been defined.
Notes
1.Click
.
2.A window is displayed, allowing you to enter the different parameters of the query.
The parameters can be ignored by unchecking the box in front of their name..
In this case, the selection condition associated with the parameter is ignored.
For example, if the pCustomerName parameter is ignored, the orders of all the
customers will be taken into account by the query.
Note: If all the parameters are unchecked, the query returns all the results.
182
To create a page used to display the result of the multicriteria search:
Creating the controls used to configure the criteria and to display the result
We are going to create a Table control based on the query then the different controls allowing the
user to select the search criteria.
Creating the Table control
To create the Table control used to display the result of the search:
1.Create a Table control: on the "Creation" pane, in the "Data" group, expand "Table" and select
"Table".
2.Click in the "PAGE_Multicriteria_search" page: the wizard for creating the Table control
starts.
3.The Table control will be based on the "QRY_FindOrders" query (that was created
beforehand). Select "Display the data found in a file or in an existing query". Go to the next
wizard step.
4.Select the query that will be used as data source for the Table control:
Expand the "Queries" group.
Select the "QRY_FindOrders" query.
Go to the next wizard step.
5.Select all the proposed items: all of them will be displayed in the Table control. Go to the
next wizard step.
6.Keep the default options in the different wizard screens and validate the creation of the
Table control.
7.The Table control is automatically created in the page.
8.Modify (if necessary) the position of the Table control so that it is entirely displayed in the
page.
184
For better readability, we are going to modify the description of the Table control.
1.Display the description of the Table control (double-click the control).
Notes
If the name of the Table control is selected, the lower section presents the
characteristics of the Table control.
If a column is selected, the lower section presents the characteristics of the
columns.
2.Click the name of the Table control. The caption of the Table control is displayed in the lower
section. We are going to modify this caption. Replace the proposed caption by "Search results".
3.Click the "COL_OrdersID" column. The title of the column is displayed in the lower section of
the screen. Replace the "Identifier of the order" caption by "ID".
Notes
186
The test parameters have been retrieved as default parameters for the execution. We are now
going to modify the page in order for the parameters to be entered by the user, via controls.
3.To build our page, we are going to switch all the code lines corresponding to parameters into
comments:
Select the "MySource ..." code lines.
Press [CTRL] + [/ on the numeric keypad].
4.Close the code editor (click the cross at the top right of the editor).
We are now going to create in our page the different controls allowing the user to select the query
parameters. These controls will be positioned above the Table control.
Move (if necessary) the Table control in the page and reduce its height in order to leave space
for creating the different control for criteria selection.
First parameter: Customer name
In order for the user to be able to enter a customer name to find, we are going to create an edit
control.
1.Display the "Analysis" pane if necessary: on the "Home" pane, in the "Environment" group,
expand "Panes" and select "Analysis". The different data files described in the "Full_WebDev_
Site" analysis are displayed in the pane.
2.Click the icon on the left of "Customer" file: the items found in the data file are listed.
3.Select the "FullName" item found in Customer file and Drag and Drop this item to the
"PAGE_Multicriteria_search" window.
4.The edit control is automatically created. Position this control above the Table control.
We are now going to pass the value entered in the edit control in parameter to the query:
1.Select the Table control and press the [F2] key.
2.In the initialization process of the Table control, replace the line:
by
MySource.pCustomerName = EDT_FullName
In this code, EDT_FullName is the name of the edit control that was just created. The value of
this control is associated with the pCustomerName parameter expected by the query.
3.Close the code editor.
188
Before running the test, we are going to create a button used to re-display the content of the
Table control according to the value selected in the Radio Button control:
1.Create a Button control:
on the "Creation" pane, in the "Usual controls" group, click
.
then, click at the top right of the page.
2.Modify the caption of the control (press the [ENTER] key). The new caption is "Find".
3.Modify the style of the control:
In the popup menu of the control (right mouse click), select "Choose a WEBDEV style".
In the window that is displayed, select "BTN_Img_Details_Bckgrd" and validate.
In this code, the taInit constant is used to re-run the initialization process of the Table control
(the process in which the parameters are passed to the query).
7.Close the code editor.
We are now going to check how the first parameter is passed:
1.To save the page, click
Notes
1.In the "Analysis" pane, click the icon on the left of the "Orders" file: the items found in the
data file are listed.
2.Select the "Status" item found in the Orders file and Drag and Drop this item to the "PAGE_
Multicriteria_search" window.
3.The Radio Button control is automatically created. Position this control above the Table
control.
190
We are now going to pass the value selected in the Radio Button control in parameter to the
query:
1.Display the processes associated with the Table control:
Select the Table control.
Display the popup menu (right mouse click) and select "Code".
2.In the initialization process of the Table control, replace the line:
by
MySource.pStatus = RADIO_Status
In this code, RADIO_Status is the name of the Radio Button control that was just created. The
value of this control is associated with the pStatus parameter expected by the query.
3.Close the code editor.
We are now going to check how the first two parameters are passed:
among the quick access buttons.
1.Click
2.Enter the name "ADDAMS" and select "Pending".
3.Click the "Find" button: only the orders placed by the customer named ADDAMS and waiting
for payment are listed.
In this example, only the orders placed by a customer and in a specific status can be listed. It
may also be interesting to list all the orders placed by a customer regardless of their status.
We are going to modify our page in order to perform this process.
To manage this case, we must:
Add a report that will be used to display all the orders,
Manage the additional report.
The new option "All orders" means that the "pStatus" parameter of the query will be ignored.
To ignore a parameter of the query, all you have to do is assign the NULL value to this
parameter. We are going to manage this case for the pStatus parameter.
1.Select the Table control in the editor and display its processes (press [F2] or select "Code"
from the popup menu of the control).
192
2.In the initialization process of the Table control, replace the line:
MySource.pStatus = RADIO_Status
by
SWITCH RADIO_Status
// All orders
CASE 1
MySource.pStatus = Null
OTHER CASE
MySourcepStatus = RADIO_Status-1
END
In this code, if the RADIO_Status control corresponds to 1 (case of "All orders" option), the
parameter of the associated query has "NULL" for value. Otherwise, the parameter has for
value the number of the selected option minus 1 (that corresponds to the option that was
just added).
3.Close the code editor.
Notes
Several payment modes can be used for an order: cash, check, ... The available payment modes
are stored in the "PaymentMode" data file.
We will be using a Combo Box control based on this data file to allow the user to select the
requested payment mode.
The "Combo Box" control is used to display a list of elements and to select an
element from this list.
Unlike a list box, a combo box displays a single element at a time: during a click
on the control, the combo box is expanded and it proposes to select another
element. A single element is selected.
The elements displayed in a combo box can be defined when creating the control
in the editor. These elements:
are defined by programming.
come from a data file or from a query.
1.On the "Creation" pane, in the "Usual controls" group, click "Combo box".
2.Click the location where the control must be created in the window (beside the radio button
that was just created for example).
3.The wizard for creating the Combo Box control starts.
4.Select "Display the data coming from a file or from a query" and go to the next step.
5.Select the "PaymentMode" data file and go to the next step.
6.The item that must be displayed in the Combo Box control is "Caption". Select "Caption". Go
to the next step.
7.Select the sort item: "Caption". Go to the next step.
8.Select the return value: "PaymentModeID". This return value is very important because it
will be passed in parameter to the query. Go to the next step.
9.Keep the default options in the different wizard screens and validate the creation of the
Combo Box control.
10.The Combo Box control is automatically created in the page.
Modify the caption of the Combo Box control (press the [ENTER] key). The new caption is
"Payment mode".
194
We are now going to pass the value selected in the Combo Box control in parameter to the
query:
1.Display the processes associated with the Table control: select the Table control and press
the [F2] key.
2.In the initialization process of the Table control, replace the line:
//MySource.pPaymentModeID = 1
by
MySource.pPaymentModeID = COMBO_PaymentMode
In this code, COMBO_PaymentMode is the name of the Combo Box control that was just
created. The value of this control is associated with the pPaymentModeID parameter
expected by the query.
3.Close the code editor.
or CTRL S).
4.Save the page (
We are now going to check how the parameters are passed:
1.Click
among the quick access buttons.
2.Enter the name "ADDAMS".
3.Change the status of orders via the radio button and modify the payment mode via the
Combo Box control, then click the "Find" button. The content of the Table control is modified.
Notes
The last query parameter corresponds to the order amount taken into account. We have a
parameter that corresponds to the minimum amount and a parameter that corresponds to the
maximum amount. The interface must allow the user to enter a price interval. To do so, we will be
using a Range Slider control.
A Range Slider control is a graphic control that can be easily included in a
WEBDEV site and that is used to select the bounds of an interval (start value and
end value).
1.On the "Creation" pane, in the "Graphic controls" group, expand "Slider" and select the range
slider with prices.
2.Click in the page, between the "Payment mode" control and the "Find" button. The range
slider is automatically created.
196
The control that was just created is an advanced control that includes the slider and two
controls displaying the bounds. The programming required to display the bounds is already
performed in the control. We are going to initialize the Slider control so that it proposes the
bounds corresponding to the data found in the Orders data file.
1.Select the Slider control and display its processes ([F2] key).
2.Insert the following code (before the existing code lines) into the initialization process of the
control:
// The lower value is the least expensive amount
HReadFirst(Orders,TotalIOT)
Myself..MinValue = Orders.TotalIOT
MySelf..LowerValue = MySelf..MinValue
// The upper value is the most expensive amount
HReadLast(Orders,TotalIOT)
Myself..MaxValue = Orders.TotalIOT
MySelf..UpperValue = MySelf..MaxValue
We are now going to pass the selected amounts in parameter to the query:
1.Display the processes associated with the Table control: select the Table control and press
the [F2] key.
2.In the initialization process of the Table control, replace the lines:
//MySource.pMinPrice = "1500"
//MySource.pMaxPrice = "3000"
by:
MySource.pMinPrice = RSLI_NoName2..LowerValue
MySource.pMaxPrice = RSLI_NoName2..UpperValue
In this code, the parameters corresponding to the prices are equal to the lower value and
upper value of the slider.
3.Close the code editor.
or CTRL S).
4.Save the page (
We are now going to check how the parameters are passed:
among the quick access buttons.
1.Click
2.Define the different parameters of the search:
Customer name,
Status,
Payment mode,
Amount.
3.Click the "Find" button. The content of the Table control is modified.
198
Notes
By default, during the click on the "Find" button, the entire page content is returned by the server.
To optimize the page display, you have the ability to enable the Ajax mode on this button. In our
example, only the content of the Table control will be returned by the server.
WEBDEV proposes several methods for using the Ajax technology in a site:
Ajax in one click: all you have to do is click in the code editor to transform a
process into an Ajax process.
Ajax controls (Table control, Looper control). The Ajax controls are used to display the data dynamically loaded from the server. No need to download everything at once!
Ajax by programming with specific WLanguage functions: AjaxExecute, AjaxExecuteAsynchronous.
1.Select the "Find" button and display its processes ([F2] key).
2.In the server click process of the button, the AJAX link appears to be struck out in the code
bar.
3.Click the AJAX link: the "JAVA enabled" link appears, indicating that the process is
automatically transformed into an Ajax process.
an invoice
200
Overview
Answers
We are going to give the user the ability to directly print the invoice corresponding to the sought
order.
If the pages have not been created in the previous lessons, you can follow this
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full WebDev site (With pages)".
A full corrected project is also available: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full WebDev site (Answer)".
202
Note
First of all, we are going to list the information that must be displayed in the report:
The characteristics of the order: date and order number.
The personal details of the customer: name, address, zip code, city and country.
The characteristics of the order lines:
Quantity ordered
Product reference
Product caption
Total BT
Total IOT
To easily create this report, the data to print will be grouped in a query. This query can be used by
the report or by any other element of the WEBDEV project (Table control, Looper control, ...).
WEBDEV proposes to create reports from several data sources: data files,
queries, controls, text files, ...
In most cases, we advise you to group the data to print via a query and to create
a report based on this query. To add an information into the report, all you have
to do is add the corresponding item into the query.
The reports based on data files must be simple reports, which means reports
used to display data coming from a single data file.
The query editor will be used to create the base query of the report.
1.Click
among the quick access buttons. The window for creating a new element is
displayed: click "Query". The wizard for query creation starts.
2.Select "Select".
Indeed, this query will be used to select the records that will be printed in the report. Go to
the next step.
3.The description window of the query is displayed.
First, give a name to the query: type "QRY_Invoice" instead of "QRY_NoName1" in the "Query
name" area.
To build the query, we are going to select the elements that will be displayed in the result. The
query will contain the content of the Orders file, the content of the OrderLine file and the
content of the Customer file.
1.In the left section of the screen, select the Orders file and click the blue arrow ( ): the items
of the Orders file are displayed in the middle of the screen.
2.Repeat this operation for the OrderLine and Customer files.
At this time, this query is used to select all the orders and the corresponding order lines.
We want to select the data corresponding to a single order whose identifier is known. Therefore,
we are going to define the order number in parameter.
Note
204
When describing a query, the area that lists the query elements includes 4
columns:
The name of the item,
The ability to display (or not) the item in the query result,
The management of the sort for the item,
The number of conditions associated with the item.
To access one of these characteristics, all you have to do is click in the
corresponding column.
3.In the window that is displayed, we are going to specify that the selection condition
corresponds to a parameter:
1.Click
among the quick access buttons.
2.The window for creating a new element is displayed: click "Report" then "Report". The wizard
for report creation starts.
3.The wizard for report creation proposes several types of reports:
6.In the list of data files and queries, select the "QRY_Invoice" query. Go to the next step.
206
7.The wizard asks you to specify whether a break is required. No break will be used in this
report. This concept will be presented later in this tutorial. Answer "No". Go to the next step.
8.You are going to specify the order in which the items will be printed and how they will be
distributed in the different blocks:
The items regarding the customer will be displayed in the "Start of document" block. Indeed,
this information must not be repeated on each line of the order.
The items regarding the order will be displayed in the "Page header" block. Indeed, this
information must not be repeated on each line of the order.
The items regarding the order lines will be displayed in the body of the report. These items
will be displayed on all the order lines of the order.
The items regarding the totals of the order will be displayed in the "End of document" block.
Indeed, this information must not be repeated on each line of the order.
The following table presents the different assignments of items in the order presented in the
wizard:
Item
Block
OrderNum
Start of document
Date
Page header
TotalBT
End of document
TotalVAT
End of document
TotalIOT
End of document
Reference
Body
Quantity
Body
TotalIOT_Ca
Body
TotalBT_Ca
Body
Part 5: Let's continue the development 207
ProductCaption
Body
UnitPriceBT
Body
Company
Start of document
FullName
Start of document
Address
Start of document
ZipCode
Start of document
City
Start of document
StateCnty
Start of document
Country
Start of document
Phone
Uncheck
Cell
Uncheck
Uncheck
208
Notes
Print margins
When choosing the print margins, don't forget to take into account the physical
margins of the printer. The physical margins of the printer are margins where no
print is allowed. Furthermore, the physical margins differ according to the printer
models.
15.Validate.
16.The table as it is defined does not fit on an A4 page in portrait mode. WEBDEV proposes:
to print the report on 2 pages in width,
to switch to landscape mode,
to reduce the size of the table.
Notes
1.The report editor asks for the print destination. The print destination can be:
Print preview: the report is displayed on a screen in a specific window.
210
Validate.
We want to position the information regarding the customer and the order in the page header:
1.Delete the captions found in front of the customer details (Name, ...).
2.Position the item containing the city beside the zip code.
3.Enlarge (with the handles) the control containing the company name: the size of the control
must be identical to the size of the Zip Code and City controls.
4.Align the controls:
Select the Company control.
Press the [CTRL] key and select (with the mouse) the controls containing the address, the
state and the country.
212
5.Select the customer details and move them (with the mouse) on the right of the report.
6.Move the order number up (to the top of the "Page header" block).
1.Create a Static control: on the "Creation" pane, in the "Usual controls" group, click "Static".
2.Click in the page header, at the location where the customer details are displayed.
3.Press the [SHIFT] key and enlarge the static control (with the handles) so that it contains all
the customer details. This operation is used to enlarge the static control without moving the
controls found below.
4.In the popup menu of the Static control, select "Edit the caption" and delete the caption.
Click in the report to validate the modification.
4.Select:
the dark blue color in the context-sensitive colors.
a simple border (thin line).
a rounding set to 2 mm in width and in height.
We are going to position the totals properly in the "End of document" block:
1.Select the controls corresponding to the totals found in the "End of document" block.
2.Position these controls with the mouse in the bottom right corner of the table.
214
5.Check the modifications performed by running the report in "Preview" mode (click
among the quick access buttons).
6.Display the code of this control ([F2] key) and enter the following server click code:
iDestination(iGenericPDF)
iInitReportQuery(RPT_Invoice, ...
TABLE_QRY_FindOrders.COL_OrdersID[TABLE_QRY_FindOrders])
iPrintReport(RPT_Invoice)
FileDisplay(iLastFile(),"application/pdf")
iPrintReport is used to start generating the "Report_Invoice" report in the specified format
(PDF in our case).
FileDisplay is used to display the invoice to the user:
iLastFile is used to get the path of the last file generated by a report.
"application/pdf" if the MIME type of the returned file. When this type is specified, the browser can display the file directly or it can choose the application that will be used to perform the
display on the computer of the Web user.
7.Close the code editor.
or CTRL S).
8.Save the report (
Test of the print
5.The browser opens the PDF file. The browser has replaced the current page by the PDF file.
We are going to change this behavior.
6.Close the browser.
Notes
3.Validate
218
an email
Overview
Several WLanguage functions allow you to manage the incoming and outgoing emails. You also
have the ability to access all the characteristics of an email:
sender, recipients,
outgoing date, subject, message,
attachments...
WEBDEV proposes several methods for managing the emails:
Management via Lotus Notes, Outloook or MS Exchange:
The Lotus Notes or Outlook messaging software: these programs allow you to send and
receive emails.
The "Simple Mail API" (also called SMAPI or Simple MAPI): this mode for email management
is used by most of the Microsoft applications, especially by Microsoft Exchange.
Management via the POP3, IMAP and SMTP protocols:
The POP3 protocol: this protocol for receiving emails is recognized by all the service
providers. It is used to communicate with the server directly, available at your ISP. This
protocol is used to list the incoming messages and to read them.
The IMAP protocol: this protocol for receiving emails is used to leave the emails on the
server so that they can be consulted from different messaging clients.
The SMTP protocol: this protocol for sending email is recognized by all the service providers.
In this lesson, we are going to create a Popup page allowing the user to send a suggestion by
email to the site developer. This popup is as follows:
To do so, we will be using the SMTP protocol. Indeed, this mode is commonly used all over the
world.
See the online help for more details about the other methods.
220
Answers
If the pages have not been created in the previous lessons, you can follow this
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full WebDev site (With pages)".
A full corrected project of the application is also available: on the "Home" pane, in
the "Online help" group, expand "Tutorial" and select "Full WebDev site (Answer)".
Example
The "Sending emails" example (unit example), supplied with WEBDEV, gives more
details about the email management. This example can be accessed from the
home window of WEBDEV.
To create the edit control corresponding to the address of the sender:
1.On the "Creation" pane, in the "Usual controls" group, expand "Edit".
2.Select the preset "Email" edit control.
3.Click in the page: the edit control is automatically created.
4.Modify the caption of the control: "Sender".
To create the edit control corresponding to the subject of the email:
An HTML edit control will be used for the body of the message: the user will have the ability to
We are now going to create the button used to send the emails.
222
This code is using an advanced EmailSMTPSession variable. The different properties of this
variable are used to define the characteristics of the SMTP session. Then, EmailStartSession
associated with this variable is used to start the session.
This code is using an Email variable. The different properties of this variable are used to
define the characteristics of the email to send. This code associates the content of the
different page controls to the properties of the Email variable.
The email is sent by EmailSendMessage. All you have to do is pass in parameter the variable
containing the characteristics of the SMTP session and the variable containing the
characteristics of the email to send.
If the email is sent, a Toast message is displayed, indicating that the email was sent. A Toast
message corresponds to a furtive message.
the code for closing the SMTP session:
// Close the SMTP session
EmailCloseSession(MySession)
Notes
or CTRL S).
The process for sending emails is given only for educational purposes. In a real
site, we would have to check the parameters entered, process the errors, save a
log file, ...
Page improvements
We are going to improve our popup page:
Add a closing button.
Start the popup page from the "PAGE_List_of_products" page.
Closing the popup page
1.On the "Creation" pane, in the "Usual controls" group, click "Button".
2.Click the position where the control must be created in the page (bottom right of "Send"
button for example).
224
3.Select the control and press the [ENTER] key on the keyboard. The caption becomes
editable. Enter "Cancel" and validate.
4.Display the processes associated with the button ([F2] key).
5.Enter the following code in the browser click code:
PopupClose()
This function is a Browser function, run on the browser only: no return to the server is
required. Therefore, we are going to modify the type of the "Cancel" button consequently:
1.Display the description window of the "Cancel" button (double-click the control for example).
2.In the "General" tab, in the "Operation on controls" area, select "None".
1.On the "Creation" pane, in the "Usual controls" group, click "Link".
2.Then, click in the top section of the page (above the search control): the Link control is
created.
3.Modify its caption: "Send a suggestion" and validate.
4.Display the description window of the control (double-click the control).
5.In the "Operation on controls" area, select "None".
6.In the "Action" area, select "None".
7.Validate the description window of the control.
8.Display the processes associated with the button ([F2] key).
9.Enter the following code in the browser click code:
PopupDisplay(POPUP_NoName1)
Notes
226
Why didn't we open the popup from the menu found in the page template?
The popup page that was created is linked to the "PAGE_List_of_products" page.
It can only be used from this page.
To use a popup from a page template, the popup must be created from the page
template.
or CTRL S).
among the quick access buttons) and open the popup for
user groupware
This lesson will teach you the following concepts...
What is the user groupware?
Integrating the user groupware
Configuring the user groupware
Checking the user groupware
228
Overview
A site can be used by different contributors with different profiles. It is sometimes necessary
to define different access levels according to the Web user (customer, salesman, manager for
example).
Let's take a simple example: when implementing an e-business site, the site proposes the
following features:
Viewing the price list,
Modifying the price list,
Entering orders,
Managing customers.
The accesses differ according to the Web user. Some examples:
the Web users can see the price list and place orders.
the sales people can see the price list, place orders and create new customers.
the sales directors have access to all the options.
Answers
WEBDEV allows you to manage these different access levels via the user groupware.
We are going to include the user groupware in our "Full_WebDev_Site" site and to configure it to
limit the access to the page for adding products.
If the pages have not been created in the previous lessons, you can follow this
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full WebDev site (With pages)".
1.On the "Project" pane, in the "Project" group, click "User groupware". The window for
configuring the user groupware is displayed.
Note
Note
Note
230
In this example, we will keep all the default options. Several options can also be
configured. See the online help for more details.
Note
The configuration of the user groupware is performed when running the site. This configuration
consists in defining the different users and their rights on the site pages and controls.
The configuration of users can be performed:
when developing the application. The necessary data files (regarding the users
and their rights) can be installed along with the site.
when the site is installed, by the administrator.
Notes
In this example, we are going to include the connection link in the "PAGE_List_of_products" page.
The connection link is supplied in the format of a control template.
A control template is a specific page containing several controls. All types of
controls can be found in this page. A control template is a file whose extension
is "WDT".
The first benefit of a control template is the reusability. A control template found
in a project can be re-used in any page of the project. The modifications are
performed once only in the control template and it is WEBDEV that applies the
modifications automatically.
The control templates can be overloaded: code can be added, the controls can
be moved in the page that is using the control template. The controls can be
modified.
4.Select the control template named "TPLC_GPU_Connection" and perform a Drag and Drop
to the "PAGE_List_of_products" page. Drop the control template above the search control.
232
1.Click the "New" button found below the "Groups" area. The screen for entering a new group is
displayed.
2.Enter the name of the group: "Product Management"
3.Click the "Save" button. The "Product Management" group appears in the list of groups
defined for the user groupware.
1.Click the "New" button found below the "Users" area. The screen for entering a new user is
displayed.
2.Enter the following information:
Login: Alice
First name: Alice
User enabled (the user account is automatically enabled in the site and it can be used
immediately).
Password: Alice. You can give the user the ability to choose his password during the first
connection.
234
Note
3.Click the "Save" button. The user named "Alice" appears in the list of users defined for the
user groupware.
To associate the user "Alice" with the "Product Management" group:
1.Select the user "Alice" in the page.
2.Select the "Product Management" group.
3.Click the addition arrow.
4.The association is performed.
We are going to define the rights for the unconnected users (which means not identified by
the groupware). These rights will be used by default when starting the site, as long as the
user is not connected.
3.Click "Next".
4.The page that is displayed is used to select each application page, page template or report.
236
For each page, page template or report, you have the ability to specify whether the element
will be accessible or not by the group.
For each page or page template, you have the ability to define whether the controls will have
the site behavior (default) or whether they will be inactive, invisible or grayed.
In our case, the "Add a product" link is found in the "PAGETPL_Menu" page template:
1.Select the "PAGETPL_Menu" page template in the list. The rights defined on the page template
will be applied to all the pages that use the template.
2.Click "Next".
3.The window for configuring the rights on the page controls is displayed.
4.Select the menu option to configure: "Sub-menu Option_2"
5.Click "Grayed".
6.Save the modifications by clicking "Save".
7.Close the browser.
Test of the site
238
the multilingual
feature
This lesson will teach you the following concepts...
What is a multilingual site?
Creating a multilingual site, step by step.
240
Answers
The following steps are used to transform a site into a multilingual site:
Choosing the project languages.
Localizing the project elements (pages, reports, controls, ...).
Localizing the messages found in the code.
Programming the change of language in the site.
We are going to apply these different steps to the "Full_WebDev_Site" project. This project,
available in English, will be translated into French.
If you did not perform the operations in the previous lessons, you can follow this
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full WebDev site (With pages)"
1.Display the project description: on the "Project" pane, in the "Project" group, click "Description".
2.Click the "Languages" tab. Our project will support English and French.
3.Click the "Add" button. The window for selecting languages is displayed.
The "Languages" tab can also be used to configure the linguistic options regarding the
numbers, the currencies, the dates, ... for the selected language. Let's see an example:
1.Click the "French" language.
2.Select the "Date" tab.
3.Specific linguistic options are used by default: you have the ability to define the date format
as well as the translation used for the days and months. If you select "Use the settings defined
in the options of the operating system", the parameters used in deployment will be the server
parameters (and not the user settings).
4.Keep "Use the following parameters".
242
Notes
In the linguistic options, you have the ability to choose the text direction for
the language ("Various" tab, "Text direction" option). This allows you to create
interfaces with a language written from right to left.
Validate. A message proposes to synchronize the different project elements. Answer "Yes". All
Notes
the project elements opened in the editor (pages, reports, ...) are closed and the additional
languages are added to these elements.
GUI errors may occur. We are going to ignore them for now. These errors will be
processed later in this tutorial.
Open the "PAGE_List_of_products" page in the editor (double-click its name in the "Project
explorer" pane for example). Validate (if necessary) the update of the template.
First of all, we must check whether the PAGE_List_of_products page is associated with the
different languages defined in the project:
1.Display the description of the page ("Description" from the popup menu of the page).
2.Select the "Language" tab: the two languages selected in the project are displayed.
3.Select the "General" tab: the title of the page must be translated.
244
Localizing an image
To change the image of the logo used in the PAGE_List_of_products page according to the
runtime language:
1.Open the "PAGE_List_of_products" page if necessary.
2.The image of the logo is found in the template associated with the page. Therefore, the
associated page template must be opened:
Click the logo and display the popup menu.
Select "Open the template".
As we are located in the page template, we are going to take the opportunity to translate the
"List of products" menu option.
In our example, we are going to translate the "List of products" option.
1.On the "Display" pane, in the "Options" group, expand "Language displayed" and select the
language that will be viewed in the editor (French in our case).
2.The menu options are displayed in the selected language. If no translation corresponds to
the selected language, the menu options are displayed in English.
3.Select the "Add a product" option.
4.Press the [SPACE] key on the keyboard: the caption becomes editable.
5.Enter the caption in French: "Ajouter un produit".
6.Validate the caption with the ENTER key.
7.Press the [ESC] key to exit from the edit mode.
or CTRL S).
8.Save the page template (
9.Switch the displayed language back to English: on the "Display" pane, in the "Options" group,
expand "Language displayed" and select "English".
10.Update the pages that use the page template by clicking
in the orange bar. Validate the
update window.
11.Close the page template displayed in the editor.
246
3.To translate this type of message, position the cursor in the "French" string and press the
[CTRL T] keys. You also have the ability, on the "Code" pane, in the "Languages" group, to
expand "Translate the strings" and select "Translate the messages".
4.The following window is displayed:
5.This window allows you to translate all the messages of your program into all project
languages.
6.In the "French" area, type "Franais" and validate.
7.The icon
as well as a digit appear in the code editor. These icons indicate that the
multilingual message exists in 2 languages.
8.Close the code editor.
3.Specify:
Whether the regional settings must be automatically enabled according to the language
used for the input. In this case, if the language requires a specific character set, this character set will be automatically selected.
248
The software or the site that must be used for the translation. You have the ability to use WDDixio, translation dictionary supplied with WDMSG (see next paragraph), a specific translation software or site, or Google Translate (see the online help for more details).
The supported languages.
4.When the translation parameters are defined, you have the ability to use the button
found in the different description windows of the project elements: this button allows you
to use the software defined for the translation.
Translation with WDMSG and WDTRAD
An optional tool named WDMSG is available, allowing you to:
check out all the project messages (caption of controls, code message, title of windows, ...) in
order to translate them,
check the translated messages back in.
The messages to translate are checked out:
in a text format that can be configured to be used by most of the translation tools
in HFSQL format.
WDMSG is also supplied with a tool for computer-assisted translation, WDTRAD. WDTRAD is used
to easily enter all the translations for the multilingual information of a project.
Contact PC SOFT Sales Department for more details about WDMSG and WDTRAD.
Other elements to translate: the framework messages
Various information and messages are found in the WEBDEV framework. For example, the names
of the days and months used by the functions for date management come from the WEBDEV
framework. To translate one or more libraries of this framework, you must use WDINT (optional
tool supplied with WDMSG).
This software is used to get a WDM extension file containing all the translations of the libraries. To
use this file in your application:
you have the ability to use LoadError.
you have the ability to include the file to the project description in the "Languages" tab. All you
have to do is select the requested language and select the "Various" tab.
1.Open (if necessary) the "PAGE_List_of_products" page in the editor (double-click its name in
the project explorer).
2.Click the menu and select "Open the template" from the popup menu.
3.In the page template, select then click "Option 3".
4.The menu becomes editable and a yellow border is displayed.
5.Press the [SPACE] key on the keyboard: the caption becomes editable.
250
While we are positioned in the page template, we are going to delete the last two menu
options:
1.Select Option 5. Display the popup menu of the option (right mouse click) and select
Delete. The option is deleted.
2.Repeat this operation to delete the option 4.
We are now going to enter the WLanguage code required to change language.
Programming
Nation(nationEnglish)
PageUse(CurrentPage())
In this code:
Nation is used to change the runtime language of the site. The constants passed in
parameter allow you to specify the language to use.
PageUse is used to re-display a page (the current page in our case) in order to take the
change of language into account.
8.Close the code window.
9.Press the [ESC] key to exit from the edit mode.
or CTRL S).
10.Save the page template (
11.Update the pages that use the page template by clicking
in the orange bar. Validate
the update window.
12.Close the page template displayed in the editor.
252
referencing
Overview
Note
This section concerns the developers of Internet sites only. The referencing is not
important if you are using an Intranet site.
Answers
This lesson presents the best practices to adopt in order for your Internet site to be properly
referenced by the search engines. Indeed, having an Internet site is a good thing, but having a
well-referenced site is even better!
If you did not perform the operations in the previous lessons, you can follow this
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full WebDev site (With pages)"
254
Referencing wizard
WEBDEV is supplied with a referencing wizard.
To start this wizard, in the ribbon, on the "Project" pane, in the "Web" group, expand
"Referencing" and select "Optimize the referencing".
The wizard proposes tips for optimizing the referencing of the site. The most important tips are as
follows:
Title of pages: The title of pages must reflect the content and it must contain the important
keywords. The title of a page is defined in the description window of the page, for each language.
Keywords of pages: We advise you to associate keywords with a page. To define these keywords:
Display the description window of the "PAGE_List_of_new_products" page: display the popup
menu and select "Description".
Display the "Details" tab.
In the "Referencing" section, click "Edit the expressions and the keywords".
Alternative text: The alternative texts are texts that are substituted to images when these ones
are not displayed (either because the Web user has explicitly requested not to display the images, or because they are not loaded yet, or even because the Web user is using a browser in
text mode or a screen for the visually impaired).
The alternative texts describe the image and they are indexed by the search engines. Therefore,
they must be chosen with great attention.
The alternative text of an image is defined in the description window of the Image control, in the
"Help" tab.
256
Properties of pages
As we just saw, the referencing wizard indicates several modifications that can be performed in
the description window of pages:
Title of the page
Keywords of pages, ...
Other properties that influence the referencing can be defined in the description window of the
page:
Frequency of update
Importance in the site
Frequency of update
The update frequency indicates to the search engine the frequency at which the page must be
reindexed.
1.In the ribbon, on the "Project" pane, in the "Web" group, click "Site map path".
2.A window is opened, allowing you to build the tree structure of your site. An automatic build
mode can help you create a tree structure by automatically detecting the links between pages.
The site map path can be configured later.
The sitemap file is automatically built by WEBDEV from the site map path. It is generated in
4.You can change the name of the generated page and validate.
258
PART 6
Site deployment
260
a site
Overview
Note
When the WEBDEV site is developed, it must be deployed on a server in order to make it accessible
to the Web users.
We are going to present the different steps required to deploy a WEBDEV site.
This section presents the deployment on a Windows server. If you want to use a
Linux server, see the documentation about the WEBDEV application server for
Linux or the online help.
Required configuration
For the deployment on the server, the following elements must have been installed and configured:
A Web server,
An FTP server,
A WEBDEV application server (a 10-connection version is supplied with WEBDEV).
Note
When installing WEBDEV, you have the ability to install the test version of WEBDEV application
server. This gives you the ability to test the deployment of your dynamic sites.
To simplify the deployment operations and to allow you to directly test the deployment of your Web
site, we will:
Install a WEBDEV Application Server 10 connections on a Windows computer. This application
server must be installed on a computer other than the development computer. WEBDEV Development must not be installed on this computer.
Deploy the site remotely (by FTP).
262
If you already have the parameters for accessing the server on which your site
will be deployed, there is no need to install the WEBDEV Application Server 10
Connections. The setup can be directly performed on the server by FTP.
Note
3.Select the setup path of the application server ("C:\WEBDEV21" by default). Validate the
directory creation.
264
Note
Note
The Hosting Control Center is a tool designed to automatically configure the Application Server,
the Web Server (IIS) and the FTP Server (IIS).
To use the Hosting Control Center:
1.Start the Hosting Control Center from the "Start" menu of Windows.
2.Select the "Hosting parameters" tab. This tab allows you to define the parameters that will
be used by default for your hosting server via four sub-tabs.
3.In the "Directories" tab, specify where the sites will be installed. Choose the root directory
where the sub-directories of the WEBDEV accounts will be created.
Use a directory local to the computer. If you want to use a network directory,
a UNC path must necessarily be specified. The Internet guest of the computer
must have access to this path without having to authenticate.
You can choose the name of the sub-directories that will contain the sites, the webservices
and the data.
4.In the "Accounts of the OS" tab, define the groups where the Windows users created for the
deployment will be assigned.
For the deployment, you can create a group or use the standard "Power Users" group.
For running sites, a good practice consists in using the "IIS_IUSRS" group (on the Windows
versions where it exists).
5.The "WebDev accounts" tab is used to specify the limitations of resources that must be
applied to the WEBDEV accounts:
Maximum number of connections that must be shared between the sites (0 corresponds to
an unlimited number),
Limitation regarding the number of sites to associate with an account, ...
6.The "HFSQL Client/Server database" is used to configure the creation of a HFSQL database
whenever a user is created.
266
4.The wizard proposes to create the necessary Windows accounts. Keep the default choices
and go to the next step.
268
Answers
1.Close (if necessary) the current project in order to display the home window.
2.In the home window, click "Tutorial" and select "Full WebDev Site (Exercise)".
If you did not perform the operations in the previous parts, open the corrected
project. This project contains the different pages created in the previous parts.
To open the corrected project, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "Full WebDev site (Answer)".
1.In the ribbon, on the "Project" pane, in the "Generation" group, expand "Deploy the site" and
select "Deploy the site remotely".
3.Before performing the setup, all the elements found in your site must be included in a
library. A library is a file that groups all the elements created during the development steps
(description of the database, pages, reports, queries, ...). The HTML pages and the images are
not included in the library.
Go to the next step.
4.Several languages can be included in the library. In our example, we will keep the default
options. Go to the next step.
270
5.The information about the library version is used to enter the elements that will be displayed
in the file properties in the Windows explorer. Go to the next step.
6.Don't save the project and validate the library creation.
Setup
The setup wizard will now ask you some questions to define how your site will be deployed. In
2.To define the server parameters, the following information must be supplied by your hosting
company. We are going to enter the information corresponding to the setup that was performed
beforehand:
Address of the server (in our example, name of the computer where WEBDEV Application
Server 10 connections was installed). The name can be:
the name of a computer accessible via network ("TESTServer" for example),
an IP address (192.168.15.99 for example),
an Internet address (www.myserver.eu for example).
Note
Characteristics of the user account entered by the hosting company in the WEBDEV account
manager.
Characteristics of the FTP account entered by the hosting company when creating an FTP
account.
Caution: the user name can be preceded by the name of the domain to avoid
confusions.
For example: "mycomputer\test" or "mydomain\test"
3.When the information regarding your WEBDEV account and your FTP account was entered,
go to the next step.
4.Enter the parameters for site deployment. We will keep the default options. Go to the next
step.
272
5.WEBDEV establishes the connection and it summarizes the operations performed (number
of updated files, number of deleted files, ...). To get the details of operations and ot modify
them if necessary, click the "Edit the list of files" button.
7.The wizard proposes to include the automatic modification of data files in the setup.
You also have the ability to configure the elements required to use a HFSQL Client/Server
database. Keep the default options and go to the next step.
274
<Project name>\Exe
For a site:
data files (.fic, .ndx, .mmo, .ftx): <data>\<site
name>
other files: <site>\<site name>
For a Webservice:
data files (.fic, .ndx, .mmo, .ftx): <data>\<site
name>
other files: <webservice>\<site name>
where:
<site>, <data> and <webservice> are the directories defined when creating the hosting account
(see above).
<site name> is the name of the site.
The distribution of the files can be configured in the deployment wizard.
a site
276
Overview
Two tools can be used to manage the WEBDEV sites (and the Webservices):
the WEBDEV administrator.
the remote WEBDEV administrator.
Note
Site: Lists the sites deployed on the server as well as their parameters:
Webservices: Lists the webservices deployed in the server as well as their parameters.
Advanced: Configures the additional server parameters such as print management, email
spooler, ...
278
Setups/Accounts: Used to lock the server for maintenance, to allow or forbid the remote setups
and to configure the log of setups. This log is used to trace the installed elements of a site. It is
very useful before contacting the Technical Support if errors occur during the deployment.
Logs: Used to see the logs for the sites or the webservices for a specific period. The elements
displayed are the elements for which errors occurred during the specified period and for which
the logs are enabled.
Caution!
The remote administrator is a WEBDEV site that provides features similar to the WEBDEV
administrator but that can be used to manage the WEBDEV sites remotely.
If you are using the remote administrator, the security configuration is important,
we advise you to access it via an HTTPS connection and to choose strong
passwords.
Note: This tool is not available for the WEBDEV application server 10 connections.
When deploying your dynamic site at a hosting company (and if this hosting company allows the
remote management of your site), this tool can be used to update the parameters of your site.
http://computer/WDAdminWeb210
280
PART 7
Specific Web
features
282
Estimated time: 1 h
Overview
WEBDEV allows you to "design" your sites. To help you with this task, WEBDEV proposes to use two
types of styles:
The CSS styles,
The WEBDEV styles.
Using styles for your controls presents a huge benefit: a modification performed in a WEBDEV or
CSS style is automatically applied to all the controls that use this style.
Let's consider the edit control for example. This control includes three elements:
the caption.
the input area.
an additional area containing the caption and the input area.
How are the styles applied to the edit control? The mode for applying the styles depends on
284
To discover the styles in WEBDEV, a simple example was prepared for you:
Tip
1.Start WEBDEV 21 (if not already done). Close (if necessary) the current project in order to
display the home window.
2.Open the "Styles" project. To do so, in the home window, click "Tutorial" and select the first
"Styles (Answer)" project.
If the home window is not displayed, on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Styles (Answer)".
This window allows you to manage the CSS styles (section 1 of the window) and the WEBDEV
styles (section 2 of the window) for the control. Let's take a look at the features of this window.
1.In the "Style" tab of the description window of the control, in the "Element" combo box,
choose the element with the requested style.
Note: All the elements marked "(CSS)" can use a CSS style directly: all you have to do is select
its name.
2.The "CSS style" combo box is used to choose the CSS style of the element: this style will be
applied to the element.
Editing the CSS style of a control
1.In the "Style" tab of the description window of the control, click the "..." found beside the "CSS
style" combo box.
286
3.This window allows you to create or modify all the CSS styles of the project.
Section 1. The status of the control onto which the style will be applied: normal, rollover,
active, ...
Section 2. The CSS properties associated with the selected status. Each CSS property can
be modified for each status.
The "Style" tab found in the description window of the control is redisplayed. In the bottom
section of the window, you have the ability to quickly access the style elements that are
frequently modified:
Caution
Font,
Size,
Bold, Italic, Underlined, Strikeout,
Vertical and horizontal alignment,
Background color.
These options are used to quickly overload the CSS style for the current control.
In this case, the modifications performed in these options will not be applied to
the other controls that use this CSS style.
The "More options" link is used to overload all the other properties of the CSS
style.
288
To manage the WEBDEV styles, use the panel displayed on the right of the "Style" tab of the
control:
The name of the WEBDEV style appears at the top of this window. You can:
Choose an existing style,
Add the style of the current control to the style sheet of the project.
This option allows you to re-use this style in other controls of the project.
Dissociate this control.
This option prevents the future style modifications from being applied to this control. This option is not recommended: we advise you to use the style overloads.
Note
The project skin defines a WEBDEV style for each type of control. This WEBDEV style can be used
"as it is" or it can be modified on some control elements.
For example, to specify that the caption must be bold on an edit control (and on this one only), you
must:
Select the "Caption (CSS)" element in the bottom area of the "Style" tab.
Select "Bold" in the bottom area.
This modification will not dissociate the WEBDEV style from the control: an overload of the Bold
property will be performed in relation to the initial style.
Therefore, if the initial style is modified (to change the background color for example), this
modification will be applied to this control while keeping the overload.
To see the overloaded elements, all you have to do is click at the top of the
panel for managing the WEBDEV styles on the link that indicates the number of
overloads performed for the control.
Via the "Style" tab found in the control description of the control (as already seen).
Via the "Modification" pane of the ribbon: a preview of the different WEBDEV styles available
for the control is displayed.
By displaying the popup menu of the control and by selecting "Choose a WEBDEV style".
290
This last method will be used to associate the control that was just created with the "EDT_
Custom" style. This style is used by all the other page controls.
Validate the window for style selection. The color of the control caption changes: the style was
applied.
Save the page (CTRL S) and run the test of the page (
We are now going modify the style of the input area found in the control:
Save the page (CTRL S) and run the test of the page (
We are now going to modify the CSS style of the input area in order to change the color of the
text typed. This modification will be performed for all the edit controls of the page.
1.Display the description window of the created control (ALT + Enter).
2.In the "Style" tab, choose the element "Input area (CSS)".
3.Click the [...] button on the right of the name of the CSS style. The window for editing the
CSS style is displayed.
4.Select the "Normal" status.
5.In the "Text" tab, change the color. Choose a green color for example.
6.Validate then validate the description window of the control.
Save the page (CTRL S) and run the test of the page (
292
cookies
What is a cookie?
Internet
A cookie is an easy way to temporarily store an information on the computer of the Web user. This
information can be read again later by the site that created it.
This allows you to avoid asking for details already supplied during a previous visit and to propose
custom pages
A cookie has an expiration date (30 days after its creation by default). It is
automatically destroyed by the browser of the Web user when its lifetime is
exceeded.
Caution: using cookies is possible only if the browser of the Web user is
configured to accept the cookies.
Note
A cookie is used to store on the computer of the Web user various information such as the user
name, the pages displayed by the user, the date of his last connection, the backup of his options,...
This information, saved in the format of cookies, will be read by the site during the next connection
of the Web user. Therefore, the site will be able to propose custom information to the user:
advertising banner related to subjects looked up during the last connection,
custom home page with the user name and the date of last connection,
special offers corresponding to the searches performed during the last visit, ...
The cookies are uncrypted when they are stored: we advise you not to use them
to store sensitive information.
294
Practical example
To check the management of cookies, we are going to import the unit example named "The
cookies" into the "Full_WebDev_Site" project.
transaction and
payment
This lesson will teach you the following concepts...
Securing the information and the pages via TSL/SSL
Secure payment
296
Secure payment
Overview
Most of the business sites allowing the Web users to perform an online purchase are using a
system for online payment by credit card.
The secure payment is an essential feature for a business site. The payment solution must
reassure the Web user (the "customer") and must guarantee the payment to the business site.
The data exchanged during this transaction must be secured (via the SSL protocol that was
described in the previous paragraph for example).
Several payment solutions are available (PayBox, ATOS, CyberMut, CyperPaiement, SPPlus,...).
The principle for secure payment may slightly change from a provider to another one but it is
overall the same:
to
Client
computer
5
Vendor
server
SSL 7
Payment
operator
Bank
Identification
(input of personal details)
Bank authorization
Check the
order
Redirection to the
secure payment
1 to 4. Preparing the order on the business site: the Web user places his order on the site. During the payment operation, the business site transfers the information used to identify the order
(vendor number, invoice amount, ...) to the payment operator.
298
Caution!
5 to 7. Entering and checking the credit card number: the Web user enters his credit card number in a secure payment page. The data transmission is protected via SSL to ensure the confidentiality of data. The business site does not know the credit card number entered by the Web
user.
8. Back to the business site: the payment operator indicates to the business site whether the
payment was validated, canceled or refused.
Important: the field of online payment evolves very quickly. Before implementing
a payment solution, always check the latest solutions proposed by the different
providers!
To open the example for using the "Secure payment" component:
300
and zoning
Overview
An anchor is used to define the behavior of a control or area when resizing the browser. Will the
control be enlarged? Will it move?
This allows you to define the behavior of pages during the display on specific resolutions (tablets,
phones, ...).
The anchors can be easily implemented via an option found in the popup menu of controls.
We are now going to use the anchors via an example.
We are going to create a project containing a page used to implement the anchors and to present
their benefits.
Notes
1.Start WEBDEV (if not already done). Close the current project if necessary.
2.In the home window, click the "Create a project" button and select "Site". The wizard for
project creation starts.
3.Enter the name of the project ("Anchors") and validate the different wizard screens with the
default options.
A corrected example can be accessed at any time to check the validity of the
operations performed.
To open this corrected project, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "Anchors (Answer)".
302
1.On the "Page" pane, in the "Edit" area, expand "Zoning" and select "Split the layout".
2.The mouse cursor turns into a pen.
3.Click at the top of the page and draw a horizontal line. The area is created when the mouse
button is released.
To view this area, we are going to associate it with a background color:
1.Display the description window of the area: select "Description of the area" from the popup
menu.
2.In the "Style" tab, select the "Border/Bckgrd" element if necessary and select a background
color (tooltip yellow for example).
3.Validate the description window of the area.
We are going to perform the same operations to split the bottom area of our page:
1.On the "Page" tab, in the "Edit" area, expand "Zoning" and select "Split the layout".
2.The mouse cursor turns into a pen.
3.Click in the middle of the bottom area and draw a vertical line.
To view these areas, associate the green color with the bottom area on the left and the
orange color with the bottom area on the right.
1.Exit from the "Zoning" edit mode by clicking the "Page" tab at the top of the page (below the
ribbon).
2.On the "Creation" pane, in the "Usual controls" group, expand "Text" and select "Simple
static".
3.Click in the yellow area. The Static control is automatically created.
4.Modify the caption ([SPACE] key on the keyboard): the caption of this control is "Header".
5.Repeat the operations 2 to 4 to create:
a Static control displaying "Menu" in the green area.
a Static control displaying "Content" in the orange area.
Save the page (CTRL S) and run the test of the page (
We are going to change this operating mode in order for the areas to adapt to the browser
size. We will be using the anchors.
1. Display the page in zoning mode: click the "Zoning" tab at the top of the page.
) and validate.
5.Select the green area, display the popup menu and select "Anchor".
6.The area must be enlarged in height: select "Height" (
) and validate.
7.Select the orange area and display the window for managing the anchors. The area must be
enlarged in width and in height: select "Width and height" (
) and validate.
1. Display the page in Page mode: click the "Page" tab at the top of the page.
2.Select "Header".
3.Display the popup menu and select "Anchor".
4.The control must be centered in width: select "Centered horizontally" (
) and validate.
5.Repeat the same operations for the "Menu" control and for the "Content" control:
The "Menu" static control must centered in height (
).
The "Content" static control must be centered in width and in height (
).
Save the page (CTRL S) and run the test of the page (
2.Resize the browser: the areas adapt to the available space in the browser.
306
PART 8
Useful
features of
WEBDEV
308
internal components
Overview
An internal component is a grouping of project elements. This grouping is used to:
organize a project,
Share elements between different projects (mainly via the Source Code Manager).
When an internal component is included in a project, all the elements of the component are
included in the project. The public elements can be handled in the editor directly. Furthermore, the
internal component can be debugged from the project that is using it.
The projects that use an internal component have access in the WEBDEV editor to the name of the
objects, procedures or methods made visible by the creator of the component.
Creating a component is child's play.
How to proceed? Do as usual, create your pages, procedures, classes. Then, when it's done,
choose the option for creating a component and that's it!
An internal component can contain code, pages, an analysis, data files, etc.
Step by step
Step 1: Creating an internal component
We are going to create an internal component used to subscribe and unsubscribe to a newsletter
in a Web site.
This component includes:
a page, used to view the list of persons who subscribed to the newsletter,
a Web control template that contains the different controls (edit of the email address, validation
button, ...),
an analysis describing the data file of subscribers.
To avoid having to develop the code required for the component to operate, all the necessary
elements have been grouped in a project named "WW_Internal_Component". We are going to
use this project to create our internal component. A new project will be created later to use this
internal component.
Notes
310
312
9.This step is used to specify the mode for managing the component data. In our case, the
internal component is using its own analysis.
10.Select "Use a specific analysis" then, in the "Analysis" control, select the analysis
corresponding to the current project ("WW_Internal_Component.wda" file found in the "WW_
Internal_component.ana" sub-directory of the project).
WEBDEV proposes to copy the analysis directory into the directory of the internal component.
Accept.
11.End the wizard. WEBDEV will create the internal component in a specific directory of your
project.
In the project explorer, the "TPLC_NewsletterSubscription" Web control template is no longer found
in the list of Web control templates for the project. On the contrary, the internal component that
was just created is listed in the "Internal Component" folder, along with its different elements:
analysis and Web control template.
Notes
Once created, your internal component can be used in any other WEBDEV project.
Let's now see how this component can be re-used.
In this example, we will present a "direct" use of the internal component. To share
resources, we recommend that you use the internal components via the Source
Code Manager (SCM).
See the online help (keyword: "Internal component") for more details.
In our example, we are going to import the internal component into the "Full_WebDev_Site" project.
314
1.In the ribbon, on the "Project" pane, in the "Project" group, expand "Import" and select "Import
an internal component .. From a file".
2.Select the "InternalComponentNewsletterSubscription.wci" file (found in the "WW_Internal_
Component\InternalComponentNewsletterSubscription" sub-directory of the WEBDEV tutorial).
3.The internal component is included in the project.
To use the internal component, we are going to instantiate the Web control template supplied
4.Select the template coming from the internal component and validate.
5.Click the location where the Web control template must be positioned in the page.
We are going to check the operating mode of the control template:
1.Run the test of the page (Go among the quick access buttons).
2.Enter an email address.
3.Click "Validate".
4.A message confirms the registration.
316
Overview
WEBDEV can manage the errors automatically. This feature helps you reduce the number of code
lines while centralizing the management of errors.
The use of this feature also makes the code easier to read.
Operating mode
Two operations are performed when an error is detected by a WLanguage function:
a return value of error is returned by the function (fOpen returns "-1" if the specified file was
not opened for example).
the error is detected by WLanguage (the ErrorDetected variable is set to True) and the error
details are returned by ErrorInfo.
This second operation can be automatically managed by the error management of WEBDEV.
Implementation
The automatic management of errors can be configured:
in the code editor: all you have to do is click the "If error: by program" link in the code editor:
318
To understand the different error cases as well as their management, we will be using a
320
1.The following page is displayed. This page is used the test the error when an integer is divided
by 0.
1.The following page is displayed. This page is used to test an error on several levels (process
calling a procedure that opens an archive that does not exist).
Example
322
Importing elements
You have the ability to import existing WEBDEV elements into your project. All types of WEBDEV
elements can be imported:
pages, reports,
classes, components,
procedures, ...
1.On the "Project" pane, in the "Project" group, expand "Import" and select "WEBDEV elements
and their dependencies...".
2.Click "..." and select the directory containing the elements to import (the directory must
include WEBDEV elements).
3.Validate. WEBDEV lists the directory elements that can be imported (the sub-directories are
ignored).
Note
4.Select the elements to import and validate. The elements (and all the files used by these
elements: images, ...) are now included in the project.
324
The "Calculate" button (found in the import window) is used to calculate the size
of the selected elements along with their dependencies.
Exporting elements
Caution!
You also have the ability to export elements from your project to another directory for example.
These elements can be re-used in other projects.
Exporting elements is a lot more than a simple copy of elements. It is actually the
only safe method for transferring a project element along with its dependencies
(images, icons, ...). A practical solution for transmitting pages along with their
dependencies by email for example.
1.On the "Home" pane, in the "General" group, expand "Save" and select "Export .. To a
directory...".
2.In the window that is displayed, select the project elements that will be exported.
Note
3.Specify the name of the destination directory (or select it with the "..." button).
4.Validate. The elements are exported to the specified directory. These elements are still
available in your project.
The "Calculate" button (found in the import window) is used to calculate the size
of the selected elements along with their dependencies.
1.On the "Project" pane, in the "Project" group, expand "Import" and select "A WINDEV or
WINDEV Mobile project". The wizard for importing a WINDEV or WINDEV Mobile project starts.
2.Select the WINDEV project to import. This project will not be modified and a new WEBDEV
project will be created.
3.Specify the name and location of the WEBDEV project to create.
4.If an analysis is linked to the project, specify its name, its location, and whether the analysis
must be used by the WEBDEV project.
5.Specify the elements that will be shared between the WEBDEV project and the WINDEV
project (common elements such as "Reports", "Classes", ...). If the elements are shared, they
will not be copied into the WEBDEV project.
6.Validate. The WINDEV project is changed into WEBDEV project.
1.Open the WEBDEV project into which the element must be imported.
2.On the "Project" pane, in the "Project" group, expand "Import" and select "WINDEV or
WINDEV Mobile elements". The import wizard starts. Select the WINDEV project containing the
elements to import or select the WINDEV elements to import. Go to the next step.
3.Specify the elements that will be shared between the WINDEV and WEBDEV projects. These
elements will not be copied into the WEBDEV project.
4.Validate. The specified elements are automatically imported into the current WEBDEV
project.
326
Note
You are interested in a page found in a non-WEBDEV site? You want to retrieve its interface?
Nothing's easier.
WEBDEV gives you the ability to import your existing HTML pages into your WEBDEV project. Each
imported page becomes an element of your WEBDEV site. This page can be modified!
The feature for importing HTML pages is a great help given to the developers of
WEBDEV sites. It is not a feature for "grabbing" Internet sites.
However, some display differences may be noticed between the HTML page
before the import and the HTML page after the import.
1.Open your WEBDEV project (an existing project or a new project for example).
2.On the "Project" pane, in the "Project" group, expand "Import" and select "An HTML page...".
The wizard for importing HTML pages starts.
3.Specify the location of the HTML page. This page can be a file found on your computer ("..."
button) or an Internet address (http://www.mywebdevsite.eu/mapping.html for example). The
HTML page is displayed in the "Page preview" frame.
4.Validate. A new WEBDEV page was just created.
5.Save the page. The page is automatically added to the list of project elements.
328
PART 9
Optimizing and
debugging a
project
330
Overview
Your site is done. It operates. You want to deploy it.
Have you thought of using the WEBDEV tools to optimize your site? WEBDEV proposes several
tools and features allowing you to quickly optimize your site and to easily avoid the predictable
bugs.
This part presents these tools and their use.
A project to optimize was prepared, allowing you to handle these features!
Opening the project
Start WEBDEV (if not already done). Close (if necessary) the current project in order to display
the home window.
To do so, in the home window, click "Tutorial" and select "Optimize a project".
Tip: if the home window is not displayed, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "Optimize a project".
332
audits
What is an audit?
The audits provide a set of features used to automatically improve the quality and the
performances of a project and to follow the conditions in which it is implemented.
Two types of audits are available:
The static audit. The static audit performs a detailed analysis of a project and elements. This
audit is performed from the project editor.
The dynamic audit. The dynamic audit analyzes the behavior of a project during its execution.
This audit can be performed in test mode or in the production environment.
We are going to test these audits on the "WW_Optimization" project.
Static audit
The static audit is a feature of the environment used to study the source code of a project in order
to detect different problems and to propose improvements.
1.In the ribbon, on the "Project" pane, in the "Audit and performances" group, expand "Edition
audit" and select "Trigger the edition audit".
Notes
The static audit of the project can also be started from the project dashboard,
via the "Static audit and Compilation" widget.
To do so, you must:
enable the Widget if necessary (click the link "Click here to re-enable").
click the arrow.
2.The wizard starts. We are going to define the target of the static audit.
334
1.Click the [...] button to get more details. The window used to list the dead code is displayed.
In the window of static audit, click the "Refresh" button to update the audit report.
336
Orphan element
The audit indicates that our project contains an orphan element.
As for the procedures run, you may create windows or reports in order to run a quick test, save
them and forget everything about them. The presence of orphan elements in the executable
unnecessarily consumes the resources distributed to the end users.
1.Click the [...] button to get more details. The window used to list the orphan elements is
displayed.
2.The "PAGE_Unused_Page" page is never called. The window that lists the orphan elements
is used to:
specify that the element is still used ("Mark as used" button). In this case, the page will not
be taken into account anymore during the audit. This option can be interesting when using a
test page specific to the development for example.
delete the page if it is actually unused ("Delete" button).
see the page ("View" button).
find the use cases in the strings for example ("Search" button).
3.In our case, this "PAGE_Unused_Page" page is actually unused, click "Delete".
4.Close the window of orphan elements (click the cross in the top right corner).
In the window of static audit, click the "Refresh" button to update the audit report.
Query to optimize
The audit indicates that our project contains a query to optimize.
This optimization is used to improve the execution speed of the query. The optimization of a query
is based on the following principle: a wizard defines the composite keys that must be modified
and/or added in the analysis associated with the project.
1.Click the [...] button to get more details. The window used to list the modifications to perform
is displayed.
2.The wizard proposes to modify an analysis item by changing it into a key with duplicates.
3.We are going to apply this change: click the "Apply these modifications to the analysis"
button.
4.A window is displayed, asking you to confirm the modification of the analysis. Validate this
window.
5.The data model editor is opened and the modification is performed. A message indicates
that the analysis must be generated. Click "Yes" to confirm the generation of the analysis.
6.The project is using data so an automatic modification of the data files is required. Validate
the different screens of the wizard for data modification (by keeping the default options).
7.The window of the static audit is automatically refreshed.
338
Dynamic audit
The dynamic audit is used to analyze the execution of the application. The audit is used to detect
problems such as:
Excessive memory consumption,
Slowness of the algorithms used,
Errors "hidden" at run time,
...
A dynamic audit can be performed in a test environment or on a live application.
The "WW_Optimization" project contains a specific page triggering errors that can be detected by
the dynamic audit.
The dynamic audit and the project test will be started at the same time.
1.In the ribbon, on the "Project" pane, in the "Test mode" group, expand "Test mode" and select
"Debug the project while the audit enabled". The test of the project is run.
Notes
The dynamic audit of the project can also be started from the project dashboard,
via the "Dynamic audit" widget. To do so, you must:
enable the Widget if necessary (click the link "Click here to re-enable").
expand the arrow and select "Detailed Go of project".
340
The top section of this window is used to choose the display mode of data. You can:
choose a chronological display (respecting the order in which the events occurred) or an
overall display, used to group the different types of problems. In this case, the chronological
border allows you to see the position and importance of problems.
choose the type of problem to display (error, assertion, ...). This allows you for example to
concentrate on the major errors, ...
The bottom section displays the different events that occurred and that may cause problems
in the application.
Notes
The dynamic audit of a project can also be performed when the site is deployed.
All you have to do is call dbgEnableAudit to trigger the dynamic audit.
The audit generates a ".wdaudit" file, this file must be loaded in the development
environment in order to analyze the result.
See the online help (keyword: "Dynamic audit") for more details.
profiler
342
Overview
The performance profiler (also called Profiler) is a tool used to check and optimize the execution
time of the processes found in your site.
Its principle is straightforward:
You run the test of your site.
During this test, the performance profiler keeps track of all the actions performed and saves the
execution times of each one of the processes to run.
At the end of the test, the performance profiler displays:
the 10 most time consuming operations,
the duration and the number of calls of all the processes run.
The "WW_Optimization" project contains a specific page used to view the interesting results with
the performance profiler.
ProfilerEnd
In this case, only the code found between ProfilerStart and ProfilerEnd is analyzed. The result is
saved in a WPF file.
The first method will be used in our example. To start the performance profiler on the
"WW_Optimization" project:
1.In the ribbon, on the "Project" pane, in the "Audit and performances" group, expand "Analyze
the performance" and select "Analyze the performance".
Notes
The performance profiler can also be started from the project dashboard, via the
"Performances" widget. To do so:
enable the Widget if necessary (click the link "Click here to re-enable").
click the arrow and select " Analyze the performances".
Let's study the report window of the performance profiler. The results are displayed in several
tabs:
the "Summary" tab presents the ten longest processes.
the "Mapping" tab presents a graphical view of the main processes.
the "Details" tab presents all the processes run during the test of the application (from the
slowest one to the fastest one).
the "Calls" tab is used to view the details of the operations performed in a process.
The "Summary" tab presents the ten longest processes. In our example, you can see that
the local procedure named "UpdateProductStock" takes more than 3 seconds to run (this
time may change according to the power of your computer).
344
The "Mapping" tab is used to visually identify what took the longest time. In our case, it is a
call to HTTPRequest:
The "Details" tab presents all the processes run, from the slowest one to the fastest one.
346
The slowdown is caused by the fact that the address specified for HTTPRequest is not
accessible.
Let's check the operating mode of the application by optimizing this code:
1.Replace the code line containing HTTPRequest by the following code line:
// Checks the accessibility of the supplier server
HTTPRequest("http://windev.com")
1.On the "Project" pane, in the "Audit and performances" group, expand "Analyze the
performances" and select "Analyze the performances".
2.The test of the project is run.
3.Click the "Test page of performance profiler" button.
4.Click the "Process to analyze" button.
5.Validate the information window and stop the project test. The report window of the
performance profiler is displayed.
6.In the "Mapping" tab, HTTPRequest does not appear with the same importance.
348
a project
Overview
Let's take a look at the debugger that is supplied with WEBDEV.
What is the debugger?
The debugger is a powerful tool used to follow the progress of a code or application, step by step.
Enhancing a process or even an application becomes child's play.
We are going to use the debugger on the long process found in the PAGE_PerformanceProfiler
page.
Note
1.Open the "PAGE_PerformanceProfiler" page in the page editor (double-click its name in the
project explorer).
2.In the WEBDEV editor, position a breakpoint in the code of the "Process to analyze" button:
click in front of the first code line of the server click process or press CTRL B, a red dot appears.
The debugger will be automatically started when the line preceded by the breakpoint is run.
3.Run the test of the "PAGE_PerformanceProfiler" page ( among the quick access buttons).
Several methods can be used to start the debugger. See the online help (keyword:
"Debugger, Run a test") for more details.
4.Click the "Process to analyze" button. The debugger starts: the code editor appears in
"Debugger" mode. The current line is preceded by a little arrow.
350
The "Debugger" pane appears in the lower section of the screen. This pane displays two distinct
areas:
the call stack: this area is used to find out the hierarchy of the processes displayed in the debugger. In our example, we are currently debugging the click process on the BTN_LongProcess
button.
the list of expressions to evaluate. By default, the main variables used in the code are displayed
in this section. You have the ability to add variables in order to follow their evolution (this feature
will be presented later).
We are going to perform some operations in the debugger to discover its capabilities.
First of all, we are going to run the different statements step by step and see the content of
variables:
1.Press the [F7] key (or press the "Detailed step by step" button). The current line is
automatically run by going into the sub-procedures if necessary.
Note: To avoid going into the sub-procedures, press the [F8] key or click the "Step by step"
button.
The values of the variables are modified (if necessary) in the "Debugger" pane (displayed at the
bottom of the screen).
2.Keep pressing the [F7] key until you reach the line "Product.Stock =
InterrogateSupplierDatabase ...", hover "Product.Stock" with the mouse cursor. A tooltip is
displayed with the value of the expression:
We are now going to add an expression to monitor the evolution of its value in the "Debugger"
pane. This expression can have any type: variable, function, operation on variables, ... The
result of the expression is calculated and displayed.
This expression is used to perform a custom debugging. For example, you can find out the
content of a variable while it is being used in the application.
1.Select "Product.Stock" in the code and display the popup menu (right mouse click). Select
"Add the expression to the debugger".
2.The expression is automatically added into the debugger pane at the bottom of the screen.
352
IF HExecuteQuery(QRY_QuantityOrdered) THEN
2.Press the [F6] key (or click the "Run until cursor" button found in the ribbon).
3.The arrow indicating the line currently run moves until it reaches the code line where the
cursor is positioned. The code lines found before the cursor are automatically run.
We are now going to add a breakpoint and to run the code until it reaches the breakpoint:
1.Click in the hatched area with the mouse, in front of HModify. A breakpoint (red bullet)
appears.
2.Press the [F5] key (or click the "Continue" button found in the ribbon). The code is run until it
reaches the breakpoint. The arrow used to identify the current line moves until it reaches the
breakpoint.
3.Click the breakpoint to remove it.
To end this test, we will be using an "Auto-stop" expression. An "Auto-stop" expression is used
to start the debugger as soon as a condition is checked or when the value of a variable is
modified. In our example, the debugger will be started as soon as the stock value is equal to
50:
1.In the "Debugger" pane, select the "Product.Stock" expression that was added beforehand.
2.Click the green circle.
3.Press the [F5] key to continue the test.
4.A message is displayed, indicating that the value of the "Product.Stock" expression changed.
5.Validate.
6.In the "Debugger" pane, select the "Product.Stock" expression. Click the expression again:
the "Expression" column becomes editable. In the "Expression" area, add "=50". You will get
"Product.Stock = 50".
7.Press the [F5] key. The program continues to run. The debugger is started again when the
value of the Product.Stock variable is equal to 50.
That's it, we presented the main features of the debugger. To stop the test in the debugger,
click "End the test" found in the ribbon.
354
PART 10
Managing
a HFSQL Client/
Server database
356
Overview
WEBDEV allows you to create applications/sites that access HFSQL Client/Server databases.
A database in Client/Server mode is used to host the databases on a server (this server can differ
from the one where the site is deployed).
This operating mode:
increases the security of data,
allows you to easily manage the multi-user mode,
simplifies the maintenance,
allows the connections from the outside (headquarters by back office for example).
Web
server
WEBDEV site
Session 1
Windows or Linux
HFSQL server
Client 1
Session 2
Manta server
Client 2
Session n
Client n
358
HFSQL
Client/Server
databases
of a
360
Overview
In this lesson, we are going to perform all the operations required to develop and to deploy a site
that is using a HFSQL Client/Server database.
Notes
Caution!
8.Install the HFSQL Control Center if this one is not already present or accessible from your
computer.
The HFSQL Control Center is required to manage the HFSQL Client/Server
database.
Notes
9.The setup is performed. By default, to connect to the server in administrator mode, use the
"admin" user without password.
Notes
Creating a WEBDEV site that is using a HFSQL Client/Server database is child's play. You must:
1.Create the project by requesting to create a new database.
2.Create the analysis by specifying that the databases used by the project will be "HFSQL
Client/Server" databases.
3.Specify the characteristics of the connection to the HFSQL Client/Server server that will be
used.
4.When creating a file in the analysis, indicate that this file is in Client/Server mode and
specify the connection used.
You can also describe the connection to the HFSQL server by programming. See
the online help ("HDescribeConnection") for more details.
Answers
362
If you did not perform the operations in the previous lessons, you can follow this
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full WebDev Site (Answer)"
the name of the server on which the HFSQL Client/Server server was installed (localhost if it
was installed on your computer for example) and the port number. Go to the next screen.
the name of the user and his password (leave this information empty to use the
administrator). Go to the next screen.
the name of the database ("Full_WebDev_Site" in our example). Go to the next screen.
6.Enter the name of the connection (keep the proposed name).
7.Go to the next step and validate. The connection to the database is automatically created.
The wizard proposes to associate the different data files found in the analysis with the
connection that was just created.
8.Click "Yes".
9.In the next screen, select all the proposed files:
11.Select the data files that will be copied onto the server: in our case, all the data files found
in the EXE directory.
364
Notes
14.Generate the analysis: on the "Analysis" pane, in the "Analysis" group, click "Generation".
An automatic modification of data files is automatically performed. You have the ability to
cancel the automatic modification of data files if all the data files are updated.
Switching to Client/Server mode: tips
Check the code of your project: in HFSQL Client/Server, HSubstDir, ... are useless.
According to the parameters specified when creating the connection, the connection defined in the analysis can be modified by HOpenConnection and HChangeConnection.
HOpenConnection can be used to go back to the HFSQL Classic mode: all you
have to do is specify the path of the directory containing the HFSQL Classic
data files.
15.You have adapted the development project. You may also have to adapt the deployed site
(if the deployed site is using HFSQL Classic files for example). This operation is configured
when creating the setup program of the site.
366
Client/
Overview
Now that we know how to create and/or adapt a site so that it operates in HFSQL Client/Server
mode, let's see how to manage the associated database.
Indeed, a Client/Server database requires:
a specific configuration of the computers (setup of a HFSQL server, ...).
a management performed via the HFSQL Control Center.
To start the HFSQL Control Center from WEBDEV and to access the data:
1.In the WEBDEV menu, on the "Tools" pane, in the "Database" group, click "HFSQL". The
HFSQL Control Center is displayed.
2.The home window of the HFSQL Control Center is displayed. The analysis of the current
project is automatically selected.
3.Validate the screen. The HFSQL Control Center is displayed. This start mode allows you to
see the different files linked to the analysis of the current project.
368
4.Click the vertical tab named "HFSQL C/S" if necessary. The list of data files in HFSQL
Client/Server format is displayed.
The Control Center lists the Client/Server data files found in the analysis linked to the current
project. No connection is established: the files are grayed.
5.To view the data found in the files, double-click one of the data files in the list on the left
("Orders" for example). If the HFSQL Control Center does not recognize all the connection
parameters, a connection window is used to perform the effective connection to the HFSQL
Client/Server server used. If this window is displayed, specify the password and validate.
6.The information about the selected data file that is using this connection is displayed in a
new tab:
The "Description" tab gives information about the data files (file items, ...).
The "Content" tab displays the records found in the data files.
The entire HFSQL Client/Server database can be managed from the HFSQL Control Center.
Caution!
A single user account is created when installing a HFSQL server and when creating a database:
the administrator account ("Admin" login without password).
Using a user account allows you to secure the access to the data. Indeed, all the users of the site
are not administrators. Specific rights can be granted to each user (or group of users).
The user rights specified in the HFSQL Control Center are granted for the
database and not for accessing the site.
Do not confuse the management of rights for the Client/Server databases with
the user groupware that was presented in a previous lesson.
Some users may not have the rights to write into some data files for example.
To run a simple test, we are going to create a user and allow this user to see the records found in
Customer file.
3.The option "Connect to a HFSQL server" is selected by default. Specify the characteristics of
the server installed in the previous lesson.
4.The characteristics of the HFSQL server are displayed in the different panels:
in the panel on the left, the computer, the name of the HFSQL server as well as the list of
databases found on this server are displayed.
in the right section of the screen, a new tab is displayed, allowing you to see the characteristics of the HFSQL server.
370
5.In the right section of the screen, select the "Users" tab. This tab is used to manage the
users of the server.
6.Only the "Admin" user exists at this time.
7.To create a new user, in the ribbon, in the "Users" group, click the "New" button. The screen
used to define the characteristics of the user is displayed.
Notes
9.Validate the user creation. By default, no rights are granted to this user.
372
We are now going to grant rights to the user: the "Test" user can connect to the database and he
can read the Customer file.
1.In the HFSQL Control Center, double-click the "Full_WebDev_Site" database. A new tab
appears.
2.On the "Full_WebDev_Site" pane, in the "Rights" group, click "Managing rights".
3.Select the "Test" user in the list of users.
4.In the list of rights, for the action named "Rights to connect to the server (encrypted and
non-encrypted connection)", click the "Defined rights" column and select the green checkmark.
5.Click the "Apply" button found at the bottom of the window (blue arrow). The rights become
effective.
6.Close the window for managing rights.
1.In the HFSQL Control Center, expand the "Full_WebDev_Site" database and double-click the
Customer file (on the left of the screen).
2.On the "Customer" pane, in the "Rights" group, click "Managing rights".
3.Select the "Test" user in the list of users.
4.In the list of rights, for the action named "Rights to read the file records", click the "Defined
rights" column and select the green checkmark.
5.Click the "Apply" button found at the bottom of the window (blue arrow). The rights become
effective.
6.Close the window for managing rights.
Similarly, rights can be defined:
on the HFSQL server,
on the database,
on the database files.
Notes
In our example, the "Test" user will have the ability to browse the records found in Customer file.
If this user tries to perform another action, a message will be displayed: "The Test user has no
sufficient rights to XXXX" (where XXXX corresponds to the action performed).
Once the account is created, it can be used when the application connects to the server (when
HOpenConnection is used).
374
The users and their rights can also be managed by programming with the
WLanguage functions. See the online help for more details.
Conclusion
The HFSQL Control Center is a tool for managing the databases, allowing you to:
stop or restart a server if a problem occurs,
manage the users and their rights,
reindex the data files if necessary,
perform backups of the database.
The HFSQL Control Center is a redistributable tool that can be installed on the computers of the
users who are working with HFSQL Client/Server databases. The HFSQL Control Center must be
used by the administrator of the database.
376
PART 11
Source Code
Manager
378
Introduction
The development of a large IS system requires the participation of several developers. These
developers must work on a single WEBDEV project while sharing the different resources (pages,
classes, ...).
WinDev is supplied with a Source Code Manager named "SCM" used to share the source codes
of different projects between developers and to find out the full history of the modifications
performed (in the code, in the interface, ...).
SCM server
LOCAL COPY
Local
project
Developer
Local network
LOCAL COPY
Reference
project
Local
project
Developer
ADSL (Internet)
LOCAL COPY
Local
project
Developer
Disconnected
Whenever a developer wants to modify a project element (page, report, query, ...), he notifies
the SCM that he is becoming the temporary owner of this element. To do so, this element
will be checked out from the SCM database by the developer.
This developer gets exclusive rights on this element: all the requested modifications can be
performed on this element.
The other developers are still working on the copy of the reference version of this element
(found in the SCM database).
When the modifications have been made by the developer, the checked-out element is
checked back into the SCM database.
380
The other developers are automatically notified of this check-in operation. They can now
update their local copy.
SCM server
CHECK OUT
AN ELEMENT
CHECK-IN
Developer
Local network
Local
project
MODIFICATION
Developer
SYNCHRONIZATION
Reference
project
ADSL (Internet)
Local
project
SYNCHRONIZATION
Developer
Disconnected
Local
project
The SCM supports teamwork and it allows you to find out the history of all the modifications.
The SCM can also be used to manage and control the elements shared between several projects.
Creating the SCM database
To share a project via the Source Code Manager, a SCM database must be created. This SCM
database must be created once only on a server.
This SCM database can be created:
when installing WEBDEV.
when creating a project that is using the SCM.
when importing a project into the SCM.
whenever you want, from WEBDEV directly or from the SCM administrator.
The SCM database can be installed in the following modes:
HFSQL Classic,
HFSQL Client/Server,
Cloud. The Cloud mode allows you to access the source codes of projects from anywhere
and at any time. See the www.pcscloud.net site for more details
Notes
In the next lesson, our SCM database will be created when importing a project into the SCM.
a project in the
382
Answers
To use an existing project with the Source Code Manager, all you have to do is include this project
in the SCM database.
If you did not perform the operations in the previous lessons, you can follow this
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full WebDev Site (Answer)"
We are now going to include the "Full_WebDev_Site" project in the SCM database:
1.In the ribbon, on the "SCM" pane, in the "Project" group, click "Add the project". The wizard for
adding projects into the SCM starts:
The SCM database was not created yet. We are going to create one.
Note: We are going to create a "Client/Server" SCM database on the server that was installed in
part 10. If you did not follow this part, you must follow the part Installing a local HFSQL server,
page 361.
2.Click the "Create a database" button.
Notes
The SCM database can be in HFSQL Classic format (local or network) or in HFSQL Client/
Server format. We are going to create a SCM database in HFSQL Client/Server format.
If the SCM database is in HFSQL Client/Server format, then this SCM database
can be used remotely.
384
8.Go to the next step. The current user is not saved in the database of users of the HFSQL
server.
We are going to create this user: click the "Create the account" button.
9.The wizard proposes to place the project in the "WebDev projects" sub-directory of the SCM
database.
10.The wizard asks you to select the project elements that must be added into the SCM
database.
Notes
386
3.In the screen that is displayed, specify (if necessary) the connection and the local directory:
Note: If the project was already opened from the SCM, the SCM proposes to open the project as
usual or to overwrite the content (to retrieve the entire project).
Notes
This operation must be performed once only by each developer who is using the project.
The developer who added the project into the Source Code Manager (you in this case!) has no
operation to perform.
The method for opening a project managed by SCM is identical to the method
for opening a project not managed by SCM: all you have to do is open the project
(".WWP" file) corresponding to the local copy.
To make sure that the automatic check-out is disabled, on the "Home" pane, in the
"Environment" group, expand "Options" and select "General options of WEBDEV". In the
"General" tab, check (if necessary) "Check out elements during the first modification".
388
a project in the
Overview
We are now going to work with the SCM in real conditions by performing the following operations:
Modify a project parameter.
Modify a project page.
We are going to modify the project by asking to display the skin on the dialog boxes:
1.Display the project description: in the ribbon, on the "Project" pane, in the "Project" group,
click "Description".
2.Click the "Skin/Styles" tab.
3.Select "Apply the skin to the dialog boxes".
4.Validate the description window of the project.
1.First of all, the window for automatic project check-out is displayed. Indeed, we want to modify
a project characteristic so the project must be checked out.
2.The option Automatically check the project back in at the end of the operation is used to
automatically check the project back in after its modification. Keep this option.
3.Validate this window.
390
4.A new window appears. This window is used to add elements and their dependencies into
the project found in the SCM database. Indeed, the option that was selected adds several
pages into the project:
1.Select the "PAGE_Poduct_form" page in the project explorer and double-click the element in
order to open it in the page editor.
2.The automatic check-out is enabled during the first modification: all you have to do is move
a control to check the element out.
3.You also have the ability to click the "Check out" icon found in the ribbon of the SCM pane
( ).
4.The check-out window is displayed:
392
On the "SCM" pane, in the "Current element" group, click the "Check in" button. The following
screen is displayed:
Notes
Notes
access the history of the element found in the SCM database ("Properties" button).
enter a comment about the modifications performed. By default, WEBDEV proposes the
comment that was typed during the check-out.
send a message to the other developers.
check in the modifications made to the element while keeping the element checked out
("Keep the element checked out").
394
If you are using the Control Centers, the current task can be ended when the
element is checked back into the Source Code Manager. This feature is useful to
follow the monitoring of the tasks, the corrections of bugs, ...
396
SCM administrator
The SCM administrator is used to directly handle the different projects included in the source code
manager.
It allows you to:
manage the SCM databases (creation, connection to a SCM database).
manage the files and directories found in a project of the SCM database (add, delete,
rename, ... files and directories).
manage the different files of the SCM database (check-in, check-out, share...).
start some tools (options, maintenance, ...).
show the history of an element.
show the status of the elements.
perform backups.
grant rights to the different SCM users.
list the projects in which you are taking part in order to dissociate from them (if necessary).
Start the SCM administrator: on the "SCM" pane, in the "Database" group, click the "Manage"
button. All the project elements are listed in the administrator.
See the WEBDEV online help (keyword: "SCM") for more details.
398
Part 12
Appendices
400
Appendice 1. Vocabulary
This lesson will teach you the following concepts...
The terms used by WINDEV, WEBDEV and WINDEV Mobile
402
Block (report)
Element constituting a report. For example, a Page Header block, a Page Footer block, a Body
block.
Control (window or page)
Graphic element used to build the GUI of a program or site.
Class (OOP)
Element defined in Object Oriented Programming. A class groups methods (actions) and members
(data).
Classic (file)
Type of access to a HFSQL file. A HFSQL file is a Classic file when it is directly accessed in its
directory.
Key (file)
Characteristics of a file item. A key item is used to optimize the searches and the sorts in a data
file.
Synonym: index
Client/Server (file)
Type of access to a HFSQL file. A HFSQL file is a Client/Server file when it is accessed by
connecting to a server containing this file via the HFSQL engine.
Project code
Code run when starting a program or a site.
External component
Software brick that is used to export one or more business rules in order to re-use them.
Internal component
Container that groups elements found in a project (window, page, query, report, class, ...) in order
to allow and simplify a share with another project.
Project configuration
Description of the output format of a project ; Windows executable, Linux, JAVA, ...
Context (Page)
Section stored in memory on a Web server that was used to build a page that is visible in a
browser.
Integrity constraint
Rule to respect associated with a file item in order to insure the consistency of data in a database.
CSS
Language for describing the styles of the different elements found in an HTML page.
Data binding
Method that is used to associate a graphic element of the GUI to a data (variable, item).
Deployment
Action that consists in installing a program on the user computer.
Editor
Program allowing you to create a project element (window editor, page editor, ...)
Report
Element of a project that defines a print to perform.
Event-driven
Type of programming. A user action on a window or on a page induces a code to run. The code of
the action to run is entered in the event representing the user action.
For example, the "Button click" event corresponds to a mouse click performed by the user on this
button.
AAF
Automatic Application Features
Style sheet
Contains the list of styles used in a project.
File (Table)
Element that constitutes a database. A file is used to store the data entered in a program.
For example, a CUSTOMER file will contain the customer information that was entered in a
program.
SCM
Source Code Manager. Tool for organizing, sharing the project sources, managing rights, ...
404
Member
Variable belonging to a class.
Popup menu
Drop-down menu containing the possible actions depending on the location where the right mouse
click was performed and on the type of the element on which this right click was performed.
Method
Procedure belonging to a class used to act on the data (members) of the class.
Control template
Container of one or more controls (with processes) that can be indefinitely re-used in pages.
Main characteristics of a template: if the initial template is modified, all the modifications are
automatically applied to the different uses of the template.
Page template
Container representing a standard page that can be applied to a page or to several pages of a
project.
Main characteristics of a template: if the initial template is modified, all the modifications are
automatically applied to the different uses of the template.
Report template
Container representing a standard report that can be applied to a report or to several reports of a
project.
Main characteristics of a template: if the initial template is modified, all the modifications are
automatically applied to the copies.
n-tier
Programming method that is using layers. Each layer is independent and it can be changed
without impacting the other ones.
Benefit: Simplified maintenance
Drawback: Difficulty and development time.
Page
Element of a WEBDEV project where the graphical interface of the site is defined. In most cases, a
site includes several pages linked together.
Parameter (window, page, procedure, method)
Element expected in a window, page, procedure or method when it is called. Each value passed in
parameter must be assigned to a variable.
406
OOP
Abbreviation of Object-Oriented Programming.
Popup
Type of window (or page). A popup is a window (or a page) that is opened on top of a window (or
page). You can still view the content of the window (or page) underneath while performing the
input in the popup.
Private
Variable or procedure that can only be used in the current element.
Procedure
Project element containing the code of a process to run.
Object-Oriented Programming (OOP)
Advanced programming method, opposed to procedural programming.
In OOP, we handle objects, which means grouped sets of variables and methods associated with
entities that include these variables and these methods.
In procedural programming, we define functions that call each others. Each function or procedure
is associated with a specific process that can be divided into sub-processes until we get basic
functions.
Project
Element that groups all the elements that constitute a program or a site. A project contains for
example an analysis, pages, reports, queries, ...
Property (control, window, ...)
Keyword representing a characteristic of an element. The properties are used to handle and
modify the characteristics of the project elements by programming.
Public
Variable or procedure that can be used from all the elements.
RAD
Acronym for Rapid Application Development
Fast development method of a program from an analysis (description of data files).
Application RAD
Fast development method of a program from a program template.
Query
Element written in SQL language that is used to access (in read-only or in read/write) the content
of a database in SQL format.
Item
Element that belongs to the structure of a data file or table (of an analysis). For example, a
CUSTOMER file can include the FirstName and LastName items.
Break (report)
Mechanism that consists in grouping and separating the data according to a value.
For example, create a break in a report that is used to list the customers by city. The customers
who live in the same city are grouped together. Visually, we separate the customers whenever the
city changes.
Dynamic site
Project developed in WEBDEV containing static and dynamic pages. The dynamic pages are used
to manage the access to the data stored in a database.
Static site
Project developed in WEBDEV containing static pages only, which means pages that do not have
access to a database.
Structure
Type of variable that includes several sub-variables.
Style
Element used to describe the graphic style of a control in a window or in a page. A style includes
for example a type of font, the size of characters, the color of characters, etc.
Table (file)
Element that constitutes a database. A table is used to store the data entered in a program. For
example, a CUSTOMER table will contain the customer names and addresses that have been
entered in a program.
Table (control)
Graphic element found in a window or in a page. A table control includes one or more columns
and rows.
Array
Type of variable that contains several values. The values can be accessed via a subscript. The [ ]
characters are used from the language to access the array elements.
408
Variable
Element that is used to store a value in memory in a program. Several types of variables exist.
Each type corresponds to the nature of the value that we want to store. For example, a string
variable to store the name of a person, a currency variable to store an amount.
Webservice
Program installed on a Web server whose processes are accessible via the Web.
XML
Language for organizing data in order to normalize and simplify the exchange of data (mainly used
in the exchanges with the Webservices).
Zoning
Method used to define the splitting of a Web page.
Appendice 2. Programming
concepts
410
Introduction
This lesson allows you to discover the programming concepts of WLanguage by presenting the
following topics:
Declaring the different types of variables,
Main statements of WLanguage,
Procedures and functions,
Processing strings,
Processing numeric values,
Processing dates and times.
Some examples:
Subscript is int
SupplierName is string
PriceTable is array of 10 currencies
I, J, K are int
Counter is int = 120
B1 is boolean = False
See the online help (keyword: "Data types") for more details
Declaring the variables and their scope
Two types of variables can be handled in WLanguage:
The global variables.
The local variables.
The global variables can be global to a project or to a page. All you have to do is declare these
variables:
in the server code for initializing the project (server variables global to the project). These variables can be used in the server code of all the processes of the project and project elements
(pages, reports, ...).
in the server code for declaring the global variables of a page (server variables global to a page).
These variables can be used in the server code of all the processes of the page and page elements.
in the server code for declaring the sets of procedures (server variables global to a set of procedures).
Caution!
The global variables declared in server code are available in the browser code
of the page for the following types only: boolean, integer, real, string, simple
array or associative array.
The modifications made in browser code to a global variable (assignment of
value for example) are not carried over in server code.
Caution!
in the browser code for loading the page (browser variables global to a page). These variables
can be used in the browser code of all the processes of the page and page elements.
The browser variables global to a page are not available in the server codes of
the page.
412
Caution!
Caution!
Most developers are tempted to declare all their variables as "global variables" in
a project. This type of programming is quite "easy". All the variables being global
variables, they can be handled from any process.
But this type of programming often causes overwritten variables and exception
problems.
Therefore, we advise you to declare a limited number of global variables and to
declare local variables when necessary.
Practical example
Now that you are familiar with the main conditional statements, let's run a real test!
Open the "PAGE_Statements" page (double-click its name in the project explorer for example).
This page presents several examples.
2.Test the different examples. The code run is displayed in the page.
3.Close the browser.
Loop statements (server code and browser code)
Notes
414
WLanguage also proposes FOR EACH and END loops used to browse the control
elements, the character strings, the records of a data file, ... These advanced
loops will be presented later in this tutorial.
Some examples
i is int = 0
WHILE i < Maximum
i ++ // Equivalent to i=i+1
END
i is int = 0
LOOP
i ++ // Equivalent to i=i+1
IF i > Maximum THEN BREAK
END
FOR i = 1 TO 100
// There is no need to declare i
Cnt ++ // Equivalent to Cnt=Cnt+1
END
Practical example
Now that you are familiar with the main loop statements, let's see the operating mode at run time
by checking the "PAGE_Statements" page again.
2.Test the different examples. The code run is displayed in the page.
3.Close the browser and go back to the editor.
Comments
To enter comments in the code, the code line must start with // (two "/" characters).
Example:
Tip
Several code lines can be set in comment ; to do so, select the code lines with
the keyboard (or with the mouse) and press the [CTRL] / keys (on the numeric
keypad).
To perform the reverse operation (to remove the comments), select the code
lines with the keyboard (or with the mouse) and press the [CTRL] [SHIFT] / keys
(on the numeric keypad).
416
Practical example
Let's see an example to understand the subtlety of these operators.
Notes
The "indirection" mechanism is used to build the name of a control, the name of a file item or the
name of a variable from a string expression.
This allows you to create generic processes independent of the names of controls, variables, file
items...
The indirection is performed by the operators { }.
To optimize the speed of your applications, the type of the element handled should be specified
when using the indirection syntax.
Therefore, if you are using a control, the corresponding type will be IndControl.
Some indirection examples:
Example of simple indirections:
{"NAME",indControl} = CustName
// is equivalent to NAME=CustName
{"NAME",indControl} = {"CU.CUSTNAME"}
// is equivalent to NAME=CU.CUSTNAME
{"PAGE_CUST.NAME",indControl} = CustName
// is equivalent to PAGE_CUST.NAME=CustName
{"PAGE_CUST"+".NAME",indControl} = CustName
// is equivalent to PAGE_CUST.NAME=CustName
Example
PROCEDURE INVISIBLE(ControlName)
{ControlName,indControl}..Visible = False
See the unit example named "Using the indirections", supplied with WEBDEV, for
more details. This example can be accessed from the home window of WEBDEV
(CTRL <).
Caution!
When a process is called several times in a project or in a page, it may be interesting to create
a procedure containing this process. Then, all you have to do is call the procedure whenever
required.
The procedures and the functions are available in programming:
The functions return a result.
The procedures are used to run a specific process.
WEBDEV allows you easily manage the two types of processes: in WEBDEV, there is no difference
between a procedure and a function. This is the reason why we shall talk about "procedure" in the
rest of this lesson.
You have the ability to create "local" procedures and "global" procedures.
The procedures in server code are not accessible in browser code and the
procedures in browser code are not accessible in server code.
However, a server procedure can be run from a browser code via the validation of
a button or via AJAXExecute.
Local procedure
A "local" procedure is linked to a single page.
A local procedure can only be used in the processes of the page where it was declared (and in the
processes of the controls found in this page). It is part of the page.
418
4.In the window that is displayed, specify the name of the set of server or browser procedures
and validate.
5.The processes associated with the set of procedures are displayed in the code editor.
6.Save the set of procedures (CTRL S).
7.The new set of procedures is displayed in the project explorer.
Then, you will have the ability to create global procedures (this creation is presented in details in
the rest of this lesson).
Calling a procedure
Tip
To call a procedure in a process, all you have to do is write its name in the code editor and specify
parameters if necessary.
WEBDEV manages the calls to nested procedures.
In the code editor, when you are positioned on a procedure name, press the [F2]
key if you want to view the code of this procedure.
Press [CTRL]+[F2] to go back to the name of the procedure in the previous code.
Creating a procedure
A procedure can be created from the main editor of WEBDEV. All you have to do is use the "Project
explorer" pane.
1.To create a local procedure: In the "Project explorer" pane, select the name of the page
associated with the local procedure.
2.Click the arrow on the left to display the different elements.
3.Select "Local procedures" (or press the [F8] key).
4.In the popup menu of "Local procedures", select:
"New local procedure" to create a local server procedure.
"New local browser procedure" to create a local browser procedure.
5.In the window that is displayed, specify the name of the procedure and click "Add".
6.The procedure appears in the code editor. Enter the code of the procedure.
420
Tip
Reminder: A procedure can also be created from the code selected in the code editor ("New ..
Create a global procedure containing the selected code" from the popup menu).
Practical example
Enough theory, let's get down to work!
In the "WW_Programming_Concepts" project, open the "PAGE_Code" page (double-click its
name in the project explorer). This page presents several examples.
double-click the name of the procedure, the code of this procedure is displayed in the code
editor.
Create a procedure used to display all the even numbers from 10 to 1 (reverse order) in the
EDT_Code edit control.
This procedure must be called from the "It's your turn" button.
Run the page test to run the test of your code.
Correction: The "Correction" button contains the solution.
In the "WW_Programming_Concepts" project, open the "PAGE_String" page. This page
presents the different operations that will be explained in this lesson.
422
Concatenation
A string can be built from several other strings. We talk of string concatenation. To concatenate
two strings, all you have to do is use the "+" operator.
// Info is used to display the result on the screen
Info(EDT_Text1 + EDT_Text2)
// Displays "WebDev"
Various operations
The size of a string is returned by Length:
Info(Length(EDT_Text))
// Display 22
A string can be changed into uppercase characters with Upper or to lowercase characters with
Lower:
Info(Upper(EDT_Text))
Info(Lower(EDT_Text))
You can also find the position of a character string inside another one while ignoring the case. To
do so, Position must be associated with the IgnoreCase constant:
Pos = Position(EDT_Text, StringToFind, 1, IgnoreCase)
To find out the number of occurrences of a given character string inside another character string,
use StringCount:
NbOccurrences is int
NbOccurrences = StringCount("anastasia", "a") // Returns 4
You also have the ability to find a string and to replace it in a single operation via Replace:
Replace(EDT_Text, "DeamDream", "WebDev")
To build a string from a string and from the result of a function, we recommend
that you use InfoBuild. This function is used to build the text displayed according
to parameters (%1, %2, ...):
InfoBuild("%1 not found in the text", ...
Tip
StringToFind)
In the "PAGE_String" page, an exercise is proposed in the "It's your turn" area:
In the "Your code" button, write the code used to display the 5th word of the text in uppercase
characters as well as the size of this word.
Run the page test to run the test of your code.
Correction: in the "Corrected" section, the "Your code" button contains the solution.
424
Tip
Various operations
Some examples of numeric operations performed in WLanguage:
The integer part of a number is returned by IntegerPart and the decimal part of a number is
returned by DecimalPart:
InfoBuild("Integer part of %1: %2" + CR + ...
"Decimal part of %1: %3", EDT_SignedReal, ...
IntegerPart(EDT_SignedReal), ...
DecimalPart(EDT_SignedReal))
In the "PAGE_Numeric" page, in the "It's your turn" area, an exercise is proposed:
In the "Calculate" button, write the code used to display (in the "Result" control) the result of
the subtraction performed between the "Amount 1" and "Amount 2" controls, rounded to 1
decimal.
Run the page test to run the test of your code.
Correction: In the "Corrected" section, the "Calculate" button contains the solution.
426
Details
The reals are used to handle the decimal numbers by programming.
The currencies can also be used to manage these decimal numbers but with a better precision.
When using reals, the rounding is performed by the system and these rounding operations may
induce calculation errors.
For example:
// The calculation is false with a Double Real variable
x is real
x=18.6 - 8.6 - 10
Error("18.6-8.6-10="+x)
To run the test of this code, click the "Operations with reals" button in the test page.
With currency variables, the calculation is performed by WLanguage.
WLanguage guarantees 23 significant digits which allows for more precise calculations.
The calculation is correct with the following code:
x is currency
x=18.6 - 8.6 - 10
Info ("18.6-8.6-10="+x)
To run the test of this code, click the "Operations with currencies" button in the test page.
To perform divisions on currencies, we recommend that you use intermediate variables of
"Currency" type.
Currency1, Currency2 are currencies
// Assigns a number to the two currency variables
Currency1 = "12 345 678 901 234 567,123456"
Currency2 = "12 345 678 901 234 567,123456"
// Divide Currency1 by Currency2
Currency1 = Currency1/Currency2
// Displays the result of the division
Info("12 345 678 901 234 567,123456"," divided by ",...
"12 345 678 901 234 567,123456 " , " = " + Currency1)
To run the test of this code, click the "Division of currencies" button in the test page.
Note
is int
is string
= 123
= i
// the variable c contains the string "123"
= "456"
= c
// the variable i contains the value 456
To transform a number into a character string while respecting a specific format, all you have to do
is use NumToString. For example:
NumToString(1234.567,"012,3f") // returns "00001234,567"
Whenever you must call NumToString without exactly knowing which parameters to use, use the
code wizard proposed by WEBDEV: this wizard will give you the syntax to use according to the
requested result.
Notes
In the code editor, various information can be displayed when typing the name of
a function followed by the opening bracket:
the name of the wizard corresponding to the function. A wizard starts if this
option is selected. Via simple questions, this wizard automatically writes
the requested syntax.
the name of an example that is using this function. The example is
automatically opened in the editor if this option is selected.
The "reverse" function of NumToString is Val. This function is used to convert a string into a
numeric value.
428
In the "WW_Programming_Concepts" project, open the "PAGE_Date" page. This page
illustrates the explanations given in the rest of this lesson.
In the "PAGE_Date" page, display the description window of the "Enter a date" control
("Description" from the popup menu of the control). Display the "General" tab. The following
information is displayed:
Note
You have the ability to choose a "System date" input mask. In this case, the
format displayed will be the one defined in the "Regional settings of the control
panel of Windows" of the computer currently run.
Caution: The parameters operating system are the ones of the server. If your site
is in English but hosted on a French server, the dates will be proposed in "DD/
MM/YYYY" format.
Let's take a look at the following examples to understand the relationships between the input
mask and the returned value:
If the input mask of a date control is "DD/MM/YY" and the returned value is "YYYYMMDD":
DateD = "20131225" // Displays the date in "25/12/13" format
DateD = "131225" // Displays the date in an incorrect format
Notes
Therefore, pay great attention to the format of the returned value in a date or time control.
The WLanguage functions that handle:
the dates use the "YYYYMMDD" format.
the times use the "HHMMSSCC" format (some of them use the "HHMMSSCCC" format to
manage the milliseconds).
Reminder: By default, the format (input mask) of the control corresponds to the
date mask defined in the "Languages" tab of the description window of the project
(on the "Project" pane, in the "Project" group, click "Description"). Therefore, the
same mask is automatically used in all the date controls of the project.
This feature is also very useful in the multilingual sites.
430
To test this feature in our example, click the "Today" button.
To display the date in a more explicit format, all you have to do is use DateToString:
Info("Today is " + DateToString(Today(),...
maskSystemDate))
DateToString transforms a string in "YYYYMMDD" format into a string in the selected format. The
maskSystemDate constant allows you to use the date format defined in the "Languages" tab of
the project characteristics.
Reminder: To display the project characteristics, on the "Project" pane, in the "Project" group, click
"Description".
To test this feature in our example, click the "DateToString" button.
What is today's date, with the day and the month in letters?
To display the date in letters, you must use DateToString with a specific date format:
Info("Today is " + DateToString(Today(), Dddd, Mmm DD, YYYY))
In this code:
the Dddd string is used to get the day in letters. For example: Tuesday.
the DD string is used to get the day in number. For example: 25.
the Mmm string is used to get the month in letters. For example: September.
the YYYY string is used to get the year. For example : 2013.
To test this feature in our example, click the "In letters" button.
How many days between 2 dates?
You want to find out how many days have passed between two dates? It's quite simple: all you
have to do is use DateDifference:
NumberDay is int
NumberDay = DateDifference("20100101", Today())
InfoBuild("Numbers of days between %1 and %2: %3", ...
DateToString("20100101", maskSystemDate),...
DateToString(Today() , maskSystemDate), NumberDay)
Note
To test this feature in our example, click the "DateDifference" button.
You also have the ability to get the duration between today's date and a specific
date in plain text (two days ago, in 3 weeks, ...). All you have to do is use:
the "Relative duration" display mask,
DateToString associated with the maskDateRelativeDuration constant. For example:
// The date is 01/22/2013
Res = DateToString("20130101",...
maskDateRelativeDuration) // Returns: 3 weeks ago
To test this feature in our example, click the "DateToStringInAlpha" button.
432
Practical exercise
Now that you are a bit more familiar with the dates: what is the purpose of the following code?
DateToString(Today(),"DDDD DD MMM YYYY")
Answer: Displays the literal date (the day and the date in everyday's language).
Handling Date variables
Specific types of variables are available for the Date, DateTime and Duration values.
These variables can be handled like "strings". Each one contains a value according to the following
table:
Type
Default format
Date
YYYYMMDD
DateTime
YYYYMMDDHHMMSSCC
Duration
YYYYMMDDHHMMSSCC
The "Date" type supports the dates from 01/01/0001 to 12/31/9999 (that should keep us going
for a while!).
More seriously, to handle the value of these variables, you have the ability to use the following
syntaxes:
MyDate is Date = "20121021"
Info(DateToString(MyDate)) //Displays "21/10/2012"
MyDate..Year = MyDate..Year + 1
MyDate..Month = MyDate..Month + 1
MyDate..Day = MyDate..Day + 1
Info(DateToString(MyDate)) //Displays "22/11/2013"
In the "PAGE_Date" page, the "Code sample" button is used to calculate the number of days
until the next January 1st by using a Date variable.
The following code is used:
MyDate is Date
// MyDate is automatically initialized to today's date
// Calculate the date of the next January 1st
NewYear is Date
NewYear..Year++
NewYear..Day = 1
NewYear..Month = 1
MyDuration is Duration = NewYear - MyDate
Info(StringBuild(...
"There are %1 days left before the next New Year's Eve",...
" on %2.", MyDuration..InDays, DateToString(NewYear))
In the "PAGE_Date" page, in the "It's your turn" area, an exercise is proposed:
In the "It's your turn" button, write the code used to calculate the date in 180 days and
display this date in letters.
Run the page test to run the test of your code.
Correction: The "Correction" button contains the solution.
In the "WW_Programming_Concepts" project, open the "PAGE_Time" page. This page
illustrates the explanations given in the rest of this lesson.
434
To test this feature in our example, click the "Now" button.
You want to display the time in "HH:MM:SS:CC" format? The code becomes:
Info("It is " + TimeToString(Now()))
To test this feature in our example, click the "TimeToString" button.
If you do not want to display the hundredths of a second, the code is:
Info("It is " + TimeToString(Now(), "HH:MM:SS"))
All you have to do is specify the display format of the time with TimeToString.
To test this feature in our example, click the "Without the hundredths" button.
How much time has passed between two given times?
It is 17:25. How much time has passed since 12:15? The code is as follows:
// Displays the time passed since 12:15
Diff is int = TimeDifference("1215", Now())
Result_Time is Time = IntegerToTime(Abs(Diff))
IF Diff < 0 THEN
InfoBuild("Time passed before 12:15 -> %1 h %2 min %3 s ", ...
Result_Time..Hour, Result_Time..Minute, ...
Result_Time..Second)
ELSE
InfoBuild("Time passed since 12:15 -> %1 h %2 min %3 s ", ...
Result_Time..Hour, Result_Time..Minute, ...
Result_Time..Second)
END
Caution!
To test this feature in our example, click the "1st example" button.
The same calculation can be performed by using the Time and Duration variables.
Specific types of variables are available for the Date, Time, DateTime and Duration values. These
variables can be handled like "strings". Each one contains a value according to the following table:
Type
Default format
Time
HHMMSSCC
Duration
YYYYMMDDHHMMSSCC
To test this feature in our example, click the "2nd example" button.
Close the browser to go back to the editor.
A practical exercise? It's your turn!
A small exercise will be used to implement the different operations that can be performed on the
dates:
In the "PAGE_Time" page, in the "It's your turn" area, an exercise is proposed:
In the "Your code" button, write the code used to display the time left before 23:59 in HH:MM
format.
Run the page test to check your code.
Correction: The "Correction" button contains the solution.
436
Appendice 3. Code
Answers
editor:
Questions/
Questions/Answers
Question
To view the element corresponding to the current process, on the "Code" pane, in the "Navigation"
group, click "Go to the object" (CTRL + ALT + F2). The page containing the requested element is
displayed.
Question
Question
The functions for performing searches or replacements (in the code, in the interface, ...) can be
accessed from the "Home" pane, in the "Find" group or in the "Find - Replace" pane (CTRL + F):
Then, you have the ability to define the different characteristics of the search to perform.
Question
What is the meaning of the "+" and "-" signs in the code editor?
The code editor allows you to expand or collapse the WLanguage code. This feature is very useful
if your processes use a lot of structured statements (loops, conditions, browses, ...).
To collapse a code section, on the "Display" pane, expand "Collapse" and select "Collapse all" (or
press [CTRL] + [SHIFT] + * (on the numeric keypad)).
Only the comments remain visible. The associated code is displayed in a tooltip when the comment
line is hovered by the mouse cursor:
438
Press [CTRL] + * (on the numeric keypad) to expand the entire code. A click performed on the "-" or
"+" symbol allows you to collapse or expand the corresponding code section.
Question
Press [F6] to display information (name and creation/modification date) about each code line.
Question
In the code editor, to enable (or not) the numbering of code lines, on the "Display" pane, in the
"Help for edit" group, click "Display the line numbers". The corresponding shortcut is [CTRL] +
[SHIFT] + [G].
Question
Question
440
Conclusion
The tutorial is over now!
This tutorial has discussed a variety of subjects, but not all the features of WEBDEV, far from it!
You are now familiar with the main concepts.
You can also explore the examples supplied with WEBDEV: some are simple and only address
one topic, while others are more complex. These examples will show you the different aspects of
WEBDEV. Reading the source code is also a good way to learn.
It would take too much time to discuss all the available topics (there are hundreds, even
thousands!). WEBDEV proposes several other features not presented in this tutorial:
HTTP functions,
nested reports, queries with parameters,
dynamic compilation, calls to DLL, ...
Conclusion 441