[PB]練習語法(不斷更新)

20221013    li_control = 1 非常重要,可直接選點選該行

//當kind = 1 (LC)必須在phf170s有資料 =0筆 清空欄位並錯誤訊息  

//當kind = 2 (TT)必須在phf170s沒有資料 < 1筆 否則清空欄位並錯誤訊息  

long  ll_row2 

string ls_order_no2 , ls_seq_no2

int ll_cnt

ll_row2 = tab_1.tabpage_1.dw_1s.getrow()

ls_order_no2    = tab_1.tabpage_1.dw_1s.getitemstring(ll_row2,"order_no")

select count(*) into :ll_cnt 

from phf170s

where phf170s.order_no = :ls_order_no2

using sqlca;

if ls_kind = '1' and ll_cnt=0 then

err_msg(2,2,"@@1"+"此~訂~購~單~不~為~類~別~LC"+"@")

li_control = 1

tab_1.tabpage_1.dw_1s.setcolumn("order_no")

tab_1.tabpage_1.dw_1s.setitem(row, "order_no", '')

goto itemchanged_exit

elseif ls_kind = '2' and ll_cnt>0 then

err_msg(2,2,"@@1"+"此~訂~購~單~不~為~類~別~TT"+"@")

li_control = 1

tab_1.tabpage_1.dw_1s.setcolumn("order_no")

tab_1.tabpage_1.dw_1s.setitem(row, "order_no", '')

goto itemchanged_exit

end if



20220905 要另外解開不然所有按鈕不能按

20220901 選取全部column迴圈設定(會排除按鈕butten)                

ll_col = long(tab_1.tabpage_1.dw_1.describe("datawindow.column.count"))


for ll_i = 1 to ll_col

tab_1.tabpage_1.dw_1.SetTabOrder(ll_i, 0)

next



20220830 在pb中insert  

insert into trf100_mail_20220830 ( send_no, keyin_emp,     crt_time,  crt_user ) 

  values ( :ls_send_no, :ls_keyin_emp, getdate(), :ls_loginuid)

commit using sqlca;  //不用等到全部程式完成,直接insert


20220111

取得dw row   while loop 讀出(計算或寫入DB)

long ll_dw3_count,ll_dw3_rowcount,ll_dw3_row

ll_dw3_rowcount  = tab_1.tabpage_1.dw_3.rowcount()

ll_dw3_count = 1

do while ll_dw3_count <= ll_dw3_rowcount

ll_dw3_row = tab_1.tabpage_1.dw_3.GetRowFromRowId(ll_dw3_count)

ls_dw3_out = tab_1.tabpage_1.dw_3.getitemstring(ll_dw3_row,"out_no")

ls_dw3_part = tab_1.tabpage_1.dw_3.getitemstring(ll_dw3_row,"part_no")

ls_dw3_pick = tab_1.tabpage_1.dw_3.getitemstring(ll_dw3_row,"ls_pick")

ll_dw3_count = ll_dw3_count+1

loop



20220111

產生亂數 Rand ( n )   EX:1~32767


20211228  提示訊息選是或否才執行

//確認刪掉的有符合資產檔累計折舊=0才有以刪除

li_rtn = wf_check_del(ls_proj,ls_auto_nos,ls_auto_noe,ls_auto_dates,ls_auto_datee)

if li_rtn > 0 then //回傳0以上表示累計折舊大於零的筆數

err_msg(2,2,"@@1"+"累計折舊大於零無法刪除!"+"@")

//tab_1.tabpage_1.dw_1.setcolumn("out_date")

goto buttonclicked_exit

else

ls_rtn2 = wf_del_count(ls_proj,ls_auto_nos,ls_auto_noe,ls_auto_dates,ls_auto_datee)

if MessageBox('提示信息','確定刪除所選資料共'+ls_rtn2+'筆',Question! ,YesNo! , 1 ) = 1 then

wf_del(ls_proj,ls_auto_nos,ls_auto_noe,ls_auto_dates,ls_auto_datee)

MessageBox('提示信息', '資料已刪除共'+ls_rtn2+'筆')

else

MessageBox('提示信息','放棄刪除')

end if

end if



20211201

//messagebox轉型數字=>文字

messagebox("percent", string(value)+"%")


20211117 

find_text  請注意  powerbuilder6.5 不支援中文查找


20211116 

tab_1.tabpage_1.dw_1.settaborder("cust_no",  0) 

//將taborder設定為0 => 不能點選object , 設為大於0可以點選

tab_1.tabpage_1.dw_1.modify( " cust_no.background.color =  '" + gs_ucolor +  "'" )

//改變背景顏色



[DataSet Bug]無法啟用條件約束。一或多個資料列的值違反非 Null、唯一或外部索引鍵條件約束

在使用TableAdapter作Query時發生 1. 原因為有些資料欄位Query出來後為null值 但是該欄位在dbDataSet的屬性AllowDBNull為False 因此把該欄位(或乾脆把全部欄位屬性AllowDBNull改為True 2. maxLength 檢...