PowerBuilder can handle many diffrent types of data. A few of the standart data type are given below:
Boolean -> True or False
Integer / Int -> 16 bit signed integer from -32768 to 32768. Whole number is not decimal points
Long -> 32 bit signed interger from -2.147.483.648 to 2.147.483.648 it is the same as an integer
String->This data type hold between 0 - 60.000 ASCII character
Blop -> A Binary Large Object can be use for extreme large data item
Datetime -> The date and time store as a single data
Dec -> These are signed decimal number with up to 18 digits
Dauble/Real -> The data types used to store very larger or very small number
Date -> Define variable as date
Rabu, 26 November 2008
Gretting Aplication
Gretting for every day
ll_jam = hour(now()) * 3600 + minute(now()) * 60 + second(now())
CHOOSE CASE ll_jam
CASE IS <>
ls_slm = 'Selamat Pagi' // good morning
CASE 39601 to 54000
ls_slm = 'Selamat Siang' // good afternoon
CASE 54001 to 64800
ls_slm = 'Selamat Sore' // good evening
CASE ELSE
ls_slm = 'Selamat Malam' // good night
END CHOOSE
ll_jam = hour(now()) * 3600 + minute(now()) * 60 + second(now())
CHOOSE CASE ll_jam
CASE IS <>
ls_slm = 'Selamat Pagi' // good morning
CASE 39601 to 54000
ls_slm = 'Selamat Siang' // good afternoon
CASE 54001 to 64800
ls_slm = 'Selamat Sore' // good evening
CASE ELSE
ls_slm = 'Selamat Malam' // good night
END CHOOSE
Senin, 24 November 2008
Open Window with parameter
when you call (open) the windows search in main windows and want to return variable you can use this script
string ls_parm
if keydown(KeyF1!) then
OpenWithParm( w_search, ls_parm, parent)
ls_parm = Message.StringParm
this.SetText(ls_parm)
end if
string ls_parm
if keydown(KeyF1!) then
OpenWithParm( w_search, ls_parm, parent)
ls_parm = Message.StringParm
this.SetText(ls_parm)
end if
Using Enter Key
Default moving between field or column is “tab key” if you want to change the movement with “enter key” you can use this script. First you can make custom data window even ( even id : pbm_dwnprocessenter even name : rowenter return variable : long an then you can use this script for data windows and using “enter key” to move pointer between field.
Send(Handle(This), 256, 9, Long(0, 0))
Message.Processed = TRUE
Message.ReturnValue = 1
Senin, 27 Oktober 2008

Windows Search
If you want to make windows seacrh with user object control you can use windows object and put the user object control in centre of the windows and then you can use single line edit for search the word and so the button for execute. if you use this windows design you can use this script and put into this script in user event.
// Entry_Chosen Script for UO_1
string ls_selected_value,ls_ret
ls_selected_value = left(return_selected (),6)
if Len (ls_selected_value) = 0 then
RETURN
END IF
// ls_selected_value = "Nothing"
ls_ret = trim(ls_selected_value)
CloseWithReturn(parent,ls_ret)
Minggu, 05 Oktober 2008
Using User Event ( ue_add) to define or adding rows
I usually use this script in windows ancestor by define custom event ( user event), this script prepare the windows for adding rows
If dw_1.AcceptText() = -1 then
MessageBox('Message','Header not complete...')
return
end if
dw_1.enabled=true
dw_1.Object.DataWindow.ReadOnly = false
If (dw_1.modifiedcount() > 0 Or dw_1.deletedCount() > 0) and &
imn_mymenu.m_file.m_save.enabled then
if messagebox("Informasi","Data harus disimpan terlebih "+&
"dahulu...Simpan?", Question!,YesNo!,2) = 1 then
triggerevent("ue_save")
end if
end if
dw_1.reset()
dw_1.scrolltorow(dw_1.insertrow(0))
if hdr_autoinc = true then
header_id ++
dw_1.SetItem(dw_1.GetRow(),hdr_pk1,header_id)
dw_1.SetTabOrder(hdr_pk1,0)
dw_1.SetColumn(hdr_set)
Else
dw_1.SetTabOrder(hdr_pk1,10)
If hdr_pk2 <> '' then
dw_1.SetTabOrder(hdr_pk2,20)
End if
If hdr_pk3 <> '' then
dw_1.SetTabOrder(hdr_pk3,30)
End if
dw_1.SetColumn(hdr_pk1)
dw_1.SetFocus()
End if
ibl_add = true
If dw_1.AcceptText() = -1 then
MessageBox('Message','Header not complete...')
return
end if
dw_1.enabled=true
dw_1.Object.DataWindow.ReadOnly = false
If (dw_1.modifiedcount() > 0 Or dw_1.deletedCount() > 0) and &
imn_mymenu.m_file.m_save.enabled then
if messagebox("Informasi","Data harus disimpan terlebih "+&
"dahulu...Simpan?", Question!,YesNo!,2) = 1 then
triggerevent("ue_save")
end if
end if
dw_1.reset()
dw_1.scrolltorow(dw_1.insertrow(0))
if hdr_autoinc = true then
header_id ++
dw_1.SetItem(dw_1.GetRow(),hdr_pk1,header_id)
dw_1.SetTabOrder(hdr_pk1,0)
dw_1.SetColumn(hdr_set)
Else
dw_1.SetTabOrder(hdr_pk1,10)
If hdr_pk2 <> '' then
dw_1.SetTabOrder(hdr_pk2,20)
End if
If hdr_pk3 <> '' then
dw_1.SetTabOrder(hdr_pk3,30)
End if
dw_1.SetColumn(hdr_pk1)
dw_1.SetFocus()
End if
ibl_add = true
Change Data Window and Drop Down Data Window with Radio Button
If you want to change data window and drop down data window using sintax in any radio button or else with even click by that , you can using this script for that before you retriving data, this script usually using in the many reporting.
dw_2.dataobject = 'dw_drop_down'
dw_1.dataobject = 'dw_report'
dw_2.settransobject(sqlca)
dw_1.settransobject(sqlca)
DataWindowChild ldw_child1
dw_2.GetChild('uk', ldw_child1)
ldw_child1.SetTransObject(SQLCA)
ldw_child1.Retrieve()
dw_2.dataobject = 'dw_drop_down'
dw_1.dataobject = 'dw_report'
dw_2.settransobject(sqlca)
dw_1.settransobject(sqlca)
DataWindowChild ldw_child1
dw_2.GetChild('uk', ldw_child1)
ldw_child1.SetTransObject(SQLCA)
ldw_child1.Retrieve()
Langganan:
Postingan (Atom)