Currently Being Moderated

I'm going to be totally honest...the last time I used PowerBuilder was about 8 years or more...and I didn't think I was going to use it again...until I read this document from my team mate Uwe Kylau called PowerBuilder Developer Center and I knew this was the time.

 

This days, everything is about SAP HANA and I can't of course, stay away from it, so I decided to swept away the dust from my PowerBuilder skills and try to make an application involving SAP HANA.

 

PowerBuilder 12.5 offers to different IDE environments, or better explained, the classic and the enhanced ones. Being an old time developer (more than 14 years now) I decided to go with the classic one.

 

First thing I did, was to open my PowerBuilder environment and prepared it to support SAP HANA via JDBC.

 

Easy as it sounds, I just need to go to Tools --> System Options --> Java and choose the folder where then ngdbc.jar is located.

 

PB_HANA_001.png

PB_HANA_002.png

 

After that, I established the connection with my Amazon Web Services SAP HANA Server. For this I went to Tools --> Database Painter and in the JDB JDBC choose New Profile... --> fill the parameters and I was ready to rock...

 

PB_HANA_004.png

PB_HANA_005.png

 

With that ready, the time for application creation was just around the corner.

 

On the menu File --> New. I create a new Workspace and a .NET Windows Forms Application and after that a Grid DataWindow.

 

PB_HANA_007.png

PB_HANA_008.png

 

When we create a DataWindow we need to specify from where it's going to take the information. For this one, choose SQL Select, and then choose the table VOTES_DETAIL which we create on the blog Quick SAP HANA and R usecase and as the field choose COUNTRY and then Design --> Distinct. As we don't want duplicated values. Save it and call it dg_country.

 

PB_HANA_009.png

PB_HANA_010.png

Repeat the same steps but this time for the field Age. Call this one dg_age.

 

When you have finished with this, create a new DataWindow but this time of type Freeform and choose External as the Data Source in the next window. This will show us a new window asking for a Result Set, use the following.

 

PB_HANA_013.png

In the editor window, choose the Country field and the go to the Properties Window and choose Edit. Change the Style type to DropDownDW and fill the following values.

 

PB_HANA_015.png

DataWindow is the the value from where we are going to get the data for our DropDown control. Save as call it ff_params.

 

Create a new DataWindow of type Grid and choose SQL Select as the Data Source. Select all fields and choose Design --> Retrieval Arguments (This is very important as it will allows us to pass the values of the Drop Down control to our report).

Specify the arguments as follows...

 

PB_HANA_017.png

 

In the Where tab fill in the parameters and the arguments. Call this one dg_report.

 

PB_HANA_018.png

 

Now, we have to create a new DataWindow (Don't worry...it's the last one) of type Graph and define the following Expressions.

 

PB_HANA_020.png

PB_HANA_021.png

PB_HANA_022.png

 

For the graph style, choose what you want...I like pies...

 

PB_HANA_023.png

 

Save it and call it dg_graph.

 

And now for something completely different...let's create a PB Object of type Window. From the menu Insert we can put two buttons and simply drag and drop the DataWindows ff_params and dg_report.

 

Your layout should end like this one...save it and call it w_window.

 

PB_HANA_026.png

 

One important thing before we go into the coding part of this blog, is that we need to go back to the Database Painter, choose our connection and go to the Preview tab, using the Copy button will help us to get the value we need, which is the connection details.

 

PB_HANA_027.png

 

Now...source code! (Screaming please)

 

Double click the application and write the following code.

 

PB_HANA_028.png

 

Going back and double click the Show Report button and paste this code.

 

PB_HANA_029.png

 

Do the same in the Show Graphic button.

 

PB_HANA_030.png

 

Finally, press right click and choose Script on w_window and add this code.

 

PB_HANA_030_2.png

 

Let's run the application and see how it works...

 

PB_HANA_031.png

PB_HANA_032.png

 

There you go...a quick and nice application using PowerBuilder and SAP HANA...

Comments

Actions

Filter Blog

By author:
By date:
By tag: