Tuesday, November 15, 2011

Calling Event with Parameter in Powerscript


object.event dynamic eventname(parm1, parm2, ...)

sample :

1). calling windows event with paramater,
parent.event dynamic ue_refresh(1)

2). object event dw_1,
dw_1.event dynamic Clicked()


-------------------

Wednesday, October 5, 2011

Powerbuilder Object Naming Standards

Listed below, only that i seldom used in my PB application for my quick reference :-
What about the rest?...hmmm...here's a link for more detail,
He's one of my favourite 'Guru'.

OBJECT PREFIX
ArrayBounds ab_
CheckBox cbx_
CommandButton cb_
Datastore ds_
Datawindow dw_
DatawindowChild dwc_
DragObject drg_
DropDownListBox ddlb_
DropDownPictureListBox ddplb_
dwObject dwo_
EditMask em_
Function f_
Graph gr_
GroupBox gb_
HScrollBar hsb_
Line li_
ListBox lb_
ListView lv_
ListViewItem lvi_
MailFileDescription mfd
MailMessage mm_
MailRecipient mr_
MailSession ms_
MDIFrame mdi_
Menu m_
MultiLineEdit mle_
NonVisualObject nvo_
OLEObject oo_
Oval ov
Picture p_
PictureButton pb_
PictureListBox plb_
Pipeline pl_
RadioButton rb_
Rectangle rec_
RichTextEdit rte_
RoundRectange rr_
SingleLineEdit sle_
StaticText st_
Structure str_
Tab tab_
TabPage tabpage_
Transaction tr_
Treeview tv_
TreeviewItem tvi_
UserObject uo_
VerticalScrollBar vsb_
Window w_
WindowObject wo_

Tuesday, October 4, 2011

Powerbuilder Variable Naming Standards - Datatypes

Variable Declaration prefix Standard :-

argument a
Global g
Instance i
Local l
Shared s

DataType prefix :-
VARIABLE TYPEPREFIXGLOBALINSTANCELOCAL
Anyaga_varnameia_varnamela_varname
Blobblbgblb_varnameiblb_varnamelblb_varname
Booleanbgb_varnameib_varnamelb_varname
Charactercgc_varnameic_varnamelc_varname
Datedgd_varnameid_varnameld_varname
DateTimedtgdt_varnameidt_varnameldt_varname
Decimaldecgdec_varnameidec_varnameldec_varname
Doubledbgdb_varnameidb_varnameldb_varname
Integerigi_varnameii_varnameli_varname
Longlgl_varnameil_varnamell_varname
Realrgr_varnameir_varnamelr_varname
Stringsgs_varnameis_varnamels_varname
Timetmgtm_varnameitm_varnameltm_varname
Unsigned Integeruigui_varnameiui_varnamelui_varname
Unsigned Longulgul_varnameiul_varnamelul_varname

Sunday, October 2, 2011

Oracle SQL Multiple Rows Return One Row


//Data table DRIVERHP :-

STAFNO | CONTACTNO
---------------------------------
STAF1 11122
STAF1 44455
STAF2 33344
STAF3 66677
STAF3 88888
STAF3 99988

//works on 10g
//the Select Statement 1 :-

SELECT F.STAFNO, RTRIM(XMLAGG(XMLELEMENT(J, F.CONTACTNO,', ')).EXTRACT('//text()'),', ') AS CONTACTNOS
FROM DRIVERHP F
GROUP BY F.STAFNO

//select statement 2 :-
SELECT F.STAFNO, WM_CONCAT(F.CONTACTNO) AS CONTACTNOS
FROM  DRIVERHP F
GROUP BY F.STAFNO

//SQL output :-

STAFNO | CONTACTNOS
---------------------------------------------------------------------
STAF1 11122, 44455
STAF2 33344
STAF3 66677, 88888, 99988

Tuesday, August 16, 2011

Disabling Datawindow Edit

if you use :-

dw_1.enabled = False //the whole datawindow object will be disabled including scrollbars

instead of that use below :-

dw_1.Object.DataWindow.ReadOnly = "yes"

//the scroll bar will still work and you can scroll up and down the datawindow

to set enable again :_

dw_1.Object.DataWindow.ReadOnly = "no"

Sunday, April 17, 2011

Checking SQL statement Status in Powerbuilder

Assume that your SQL in Powerbuilder script as below :-

//DECLARE sqlca is your transaction...
transaction SQLCA

SELECT * FROM MYTABLE A WHERE A.MYCOL = '01234' using SQLCA;

if SQLCA.sqlcode = 100 then
    messagabox('Error', 'Record Not Found',StopSign!)
    return
end if

/*
SQLCA.sqlcode = 100 //result not found
SQLCA.sqlcode = 0 //result found or SQL return no error
SQLCA.sqlcode = -1 //returns error in SELECT or INSERT or UPDATE
*/

Thursday, April 7, 2011

First Character of Word UpperCase in SQL

SELECT INITCAP(A.NAME) FROM BIODATA A;

//data example : HARIMADA SABALKUNAN
//SQL output example : Harimada Sabalkunan

Getting Column Data Length with SQL in Oracle

SELECT * FROM RESULTS A
WHERE LENGTH(A.MATRIXNO) = 8;


//Above SQL will select data from table RESULTS that contains the length of MATRIXNO field equals 8 (eight)

//oracle 9G.