Top Banner
Graphical RPG Framework for IBM i SilverDev Tutorial How to Build a Graph in IBM i Applications?
19

[Tutorial] Build a graph in RPG with SilverDev

Jul 19, 2015

Download

Software

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: [Tutorial] Build a graph in RPG with SilverDev

Graphical RPG Framework for IBM i

SilverDev Tutorial How to Build a Graph in IBM i Applications?

Page 2: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 2/ 19

Steps:

1. Build a new program ...................................................................................... 3

2. Screen preparation ......................................................................................... 6

3. Graphs types ................................................................................................... 9

4. Data insertion ............................................................................................... 11

5. Compilation .................................................................................................. 14

6. CLP Creation ................................................................................................. 15

7. 1st deployment ............................................................................................ 17

8. Result ............................................................................................................ 18

Page 3: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 3/ 19

1. Build a new program

Launch SilverDev Designer and select a context from the menu Tools > Context.

Page 4: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 4/ 19

Use the « + » icon to create your new program, in the Context tab

This program will contain SQL : Select SVDSQLRPG type

Page 5: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 5/ 19

Your program appears on the Context tab list Double-click it to open it

Page 6: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 6/ 19

2. Screen preparation

Put first a panel on the top of the screen: On the Components tab, click on the CPanel icon and place it on the screen with another click. To adapt it to the screen width, use the Align property on the Inspector tab: alTop value.

Page 7: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 7/ 19

Add a button to load data.

Use CButton Component, place it on the screen and name it ‘Load’ with its Caption property.

Page 8: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 8/ 19

Now prepare the graph display area: Use a CChart Component and select alClient value on the Align property

Page 9: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 9/ 19

3. Graphs types

Double click on the graph area

This pop-up appears. Click the New icon, at the top left, to insert new

series.

You can choose your graph type on this dialog box. We select the pie one.

Page 10: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 10/ 19

The form is ready to receive data. Be careful: This screen is a preview. It does not displays real data

Page 11: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 11/ 19

4. Data insertion

We’ll use the Load button to load data. Select it on the form.

On the Events tab, select and double click the OnClick event.

The source code has been automatically updated

Page 12: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 12/ 19

We’ll use data on two tables from SilverDev demo library : On table contains a book list (sddmbks), the other one contains books themes (sddmthm). The graph will display the number of books of each theme.

Declare your variables:

And prepare SQL query :

Page 13: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 13/ 19

Before displaying query’s resulsts, we need to clear previous data so they don’t overlap Use sdSeriesClear function:

Now you can add data with sdAddPie function

Tip: To get more info on SilverDev functions, use F1.

Page 14: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 14/ 19

5. Compilation

Save and compile the form Then Generate your program on Compiling menu

Page 15: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 15/ 19

6. CLP Creation

To deploy the app, you need a CLP. Let’s build it on SilverDev:

Open a new member Add on it your library and call your RPG program :

Page 16: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 16/ 19

Save the CLP

And compile it.

Page 17: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 17/ 19

7. 1st deployment

Launch MyDesk and right click where you want to make your application available. Then, choose « New application » Fill the dialog box with the application title, the file name and the call command. On next screen, select the app authorizations.

Page 18: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 18/ 19

8. Result

You can now launch your application and click the Load button to load data:

Page 19: [Tutorial] Build a graph in RPG with SilverDev

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 19/ 19

More info on www.silverdev.com

EXPERIA Europe 4, rue L.Beridot

Les jardins d'Epione 38500 VOIRON - FRANCE

www.experia.com [email protected]