Friday, November 28, 2008

Get Field dalam datawindows Report ( Tabular )

Untuk mengambil file dari datawindows pada row model report ( tabular ) digunakan perintah
//==untuk row / abris yang sedang aktif
string ls_var1
dec lc_var2, lc_hitung
date ld_var3
datetime ldt_var4
int baris

dw_1.retrieve() //==mengambil data

for baris = 1 to dw_1.rowcount()

ls_var1 = dw_1.getitemstring(baris,'field1')
lc_var2 = dw_1.getitemnumber(baris,'field2')
ld_var3 = dw_1.getitemdate(baris,'field3')
ldt_var4 = dw_1.getitemdatetime(baris,'field4')

//===hitung
lc_hitung = lc_var2 * 100

next

Get Data Windows Variable ( get field )

get the row of datawindows we can use this sintaks:


string ls_var1
dec lc_var2
date ld_var3
datetime ldt_var4

ls_var1 = dw_1.getitemstring(dw_1.getrow(),'field1')
lc_var2 = dw_1.getitemnumber(dw_1.getrow(),'field2')
ld_var3 = dw_1.getitemdate(dw_1.getrow(),'field3')
ldt_var4 = dw_1.getitemdatetime(dw_1.getrow(),'field4')

Thursday, November 27, 2008

Declaring Variable

To declare a variable, you first type in the data type followed by the name of variable. You can also assign the variable a default value by makin the name equal to appropriate value

Integer il_var_sex
Long ll_salary = 1000000
Date ld_daytogo
Date startdate = 1995-03-01

Data Types

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

Wednesday, November 26, 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

Tuesday, November 25, 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

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