[Tutorial] Build a graph in RPG with SilverDev

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

Transcript of [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?

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

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.

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

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

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.

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.

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

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.

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

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

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 :

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.

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

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 :

SilverDev – Tutorial – Build a Graph

Experia Europe – All Rights Reserved -- 16/ 19

Save the CLP

And compile it.

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.

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:

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]