[ 파워빌더.DDDW - 디스플레이 된값을 가져오는 함수  ]

 

☞   

  /*
 string gf_dddw_data( datawindow ad_datawindow, long al_row, string as_column_name )
 dddw에 디스플레이 된값을 가져오는 함수이다.
 반환은 String값이며 DataWindow와 Row 값, 컬럼의 이름을 주면 된다.
*/
any la_any
string ls_dispcol, ls_codecol, ls_coltype
long ll_frow
datawindowchild dwc
la_any = ad_datawindow.GetItemString(al_row, as_column_name)
ad_datawindow.getchild(as_column_name, dwc)
ls_dispcol = ad_datawindow.describe(as_column_name + ".DDDW.DisplayColumn")
ls_codecol = ad_datawindow.describe(as_column_name + ".DDDW.DataColumn")
ls_coltype = dwc.describe(ls_codecol + ".coltype")
if pos(ls_coltype,'char') > 0 or pos(ls_coltype,'date') > 0 or pos(ls_coltype,'datetime') > 0 then
 ll_frow = dwc.find(ls_codecol + " = '" + string(la_any) + "'", 1, dwc.rowcount())
else
 ll_frow = dwc.find(ls_codecol + ' = ' + string(la_any), 1, dwc.rowcount())
end if
if ll_frow > 0 then
 ls_coltype = dwc.describe(ls_dispcol + ".coltype")
 if pos(ls_coltype,'(') > 0 then ls_coltype = left(ls_coltype,pos(ls_coltype,'(') - 1)
 choose case ls_coltype
  case 'decimal'
   la_any = dwc.getitemdecimal(ll_frow,ls_dispcol)
   return string(la_any, "#,###")
  case 'number', 'long'
   la_any = dwc.getitemnumber(ll_frow,ls_dispcol)
   return string(la_any, "#,###")
  case 'char'
   la_any = dwc.getitemstring(ll_frow,ls_dispcol)
   return string(la_any)
  case 'date'
   la_any = dwc.getitemdate(ll_frow,ls_dispcol)
   return string(la_any, "YYYY-MM-DD")
  case 'datetime'
   la_any = dwc.getitemdatetime(ll_frow,ls_dispcol)
   return string(la_any, "YYYY-MM-DD HH:MM:SS")
 end choose
end if
return ""

Posted by 농부지기
,