File: n_svc_dwmaker.sru
Size: 22631
Date: Mon, 07 Apr 2008 21:31:43 +0200
$PBExportHeader$n_svc_dwmaker.sru
$PBExportComments$DW maker service
forward
global type n_svc_dwmaker from n_svc_dw
end type
end forward

global type n_svc_dwmaker from n_svc_dw
end type
global n_svc_dwmaker n_svc_dwmaker

type variables
Protected:

CONSTANT string DYNAMIC_DW = "datawindow_dynamic"

/* 1=name, 2=datatype */
CONSTANT string COL_DEF = 'column=(type={2} updatewhereclause=no name={1} dbname="{1}")'
/* 1=name, 2=ID, 3=x, 4=y, 5=width, 6=height, 7=border */
CONSTANT string COL_CONTROL = 'column(band=detail id={2} alignment="0" tabsequence=10 border="{7}" color="33554432" x="{3}" y="{4}" height="{6}" width="{5}" format="[general]" html.valueishtml="0"  name={1} visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912")'
/* 1=name, 2=Text, 3=x, 4=y, 5=width, 6=height */
CONSTANT string LABEL_CONTROL = 'text(band=detail alignment="0" text="{2}" border="0" color="33554432" x="{3}" y="{4}" height="{6}" width="{5}" html.valueishtml="0"  name={1} visible="1"  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912")'

CONSTANT string LABEL_POS_X = "88" //x of labels
CONSTANT string LABEL_HEIGHT = "76" //height, same for column
CONSTANT string LABEL_PAD_Y = "48" //y and pad of labels
CONSTANT string COLUMN_PAD_X = "8" //distance between label and column

CONSTANT string BORDER_NONE = "0"
CONSTANT string BORDER_LOWERED = "5"
end variables

forward prototypes
public function string of_makedw (ref n_svc_mgr anv_svc, readonly string as_colnames[], readonly string as_datatypes[])
public function string of_makedwform (ref n_svc_mgr anv_svc, readonly powerobject apo)
protected function integer of_lookupindex (readonly string as_stringarray[], readonly string as_searchvalue)
public subroutine of_clonecolumn (readonly powerobject apo_source, readonly powerobject apo_clone, readonly string as_colname)
protected function string of_stripquotes (readonly string as_string)
public function string of_makedwformretrieval (ref n_svc_mgr anv_svc, readonly powerobject apo, readonly powerobject apo_destination)
public function string of_makedwformretrieval (ref n_svc_mgr anv_svc, readonly powerobject apo)
end prototypes

public function string of_makedw (ref n_svc_mgr anv_svc, readonly string as_colnames[], readonly string as_datatypes[]);//===========================================================================
// Function: of_Makedw (public )
// Object: n_svc_dwmaker
//---------------------------------------------------------------------------
// Description:
// Note:
//---------------------------------------------------------------------------
// Parameters:
//  reference n_svc_mgr anv_svc
//  readonly String as_colnames[]
//  readonly String as_datatypes[]
//---------------------------------------------------------------------------
// Returns: String
//---------------------------------------------------------------------------
// Author: (Yeyi) Gabriel B. Abulencia
//===========================================================================
string ls_ret, ls_mod, ls_err
n_ds lds
long ll_count, n
n_svc_string lnv_str

lds = CREATE n_ds
lds.of_SetDataobject(DYNAMIC_DW)
ls_ret = lds.Describe("Datawindow.Syntax")

anv_svc.of_LoadSvc(lnv_str, CSvc.STRING)

ll_count = UPPERBOUND(as_colnames)
FOR n = 1 to ll_count
   ls_mod += lnv_str.of_Format(COL_DEF, {as_colnames[n], as_datatypes[n]}) + CString.CR_NEWLINE
NEXT

ls_ret = lnv_str.of_Globalreplace(ls_ret, "table()", "table(" + ls_mod + ")", TRUE)

//create using new syntax
lds.Create(ls_ret, ls_err)

IF ls_err <> CString.EMPTY THEN
   //an error occured
   DESTROY lds
   SETNULL(ls_ret)
   RETURN ls_ret
END IF

ls_ret = lds.Describe("Datawindow.Syntax")

DESTROY lds

RETURN ls_ret
end function

public function string of_makedwform (ref n_svc_mgr anv_svc, readonly powerobject apo);//===========================================================================
// Function: of_Makedwform (public )
// Object: n_svc_dwmaker
//---------------------------------------------------------------------------
// Description:
// Note:
//---------------------------------------------------------------------------
// Parameters:
//  reference n_svc_mgr anv_svc
//  readonly PowerObject apo
//---------------------------------------------------------------------------
// Returns: String
//---------------------------------------------------------------------------
// Author: (Yeyi) Gabriel B. Abulencia
//===========================================================================
string ls_syntax, ls_colnames[], ls_datatypes[]
string ls_vcolnames[]
string ls_error, ls_tmp, ls_name, ls_mod, ls_colmod, ls_text[]
n_ds lds
long ll_count, n, ll_colwidth, ll_colx
long ll_y, ll_increment, ll_labellen, ll_len
n_svc_string lnv_str

IF NOT of_IsServicableobject(apo) THEN RETURN CString.EMPTY

//create the syntax for columns
ll_count = of_GetColumns(anv_svc, apo, ls_colnames, ls_datatypes)
ls_syntax = of_MakeDW(anv_svc, ls_colnames, ls_datatypes)

//now let's get the visible columns to create
ll_count = of_GetVisibleColumns(anv_svc, apo, ls_vcolnames, FALSE, TRUE)

//create datastore
lds = CREATE n_ds
lds.Create(ls_syntax, ls_error)
IF ls_error <> CString.EMPTY THEN
   //error on create
   ls_syntax = CString.EMPTY
ELSE
   anv_svc.of_LoadSvc(lnv_str, CSvc.STRING)
   
   ll_increment = (LONG(LABEL_PAD_Y) + LONG(LABEL_HEIGHT))
   ll_y = LONG(LABEL_PAD_Y) + 24
   FOR n = 1 to ll_count
      //check the source for label identified by "<colname>_t"
      ls_name = ls_vcolnames[n] + "_t"
      ls_tmp = apo.DYNAMIC Describe(ls_name + ".Text")
      IF of_IsErrorString(ls_tmp) THEN
         ls_tmp = of_MakeFriendlyName(ls_vcolnames[n])
      ELSE
         ls_tmp = of_stripquotes(ls_tmp)
      END IF
      
      //add semi-colon
      IF RIGHT(ls_tmp, 1) <> ":" THEN ls_tmp += ":"
      
      //store text
      ls_text[n] = ls_tmp
      
      //label
      /* 1=name, 2=Text, 3=x, 4=y, 5=width, 6=height */
      ls_mod += "CREATE " + &
            lnv_str.of_Format(LABEL_CONTROL, { &
                           ls_name, &
                           ls_tmp, &
                           LABEL_POS_X, &
                           STRING(ll_y), &
                           "{1}", /*use marker for changing width*/&
                           LABEL_HEIGHT}) + CString.SPACE
      
      //column
      /* 1=name, 2=ID, 3=x, 4=y, 5=width, 6=height, 7=border */
      ls_colmod += "CREATE " + &
            lnv_str.of_Format(COL_CONTROL, { &
                           ls_vcolnames[n], &
                           STRING(of_Lookupindex(ls_colnames, ls_vcolnames[n])), /* determine colID*/&
                           "{1}", /*use marker for changing X*/&
                           STRING(ll_y), &
                           "{2}", /*use marker for changing width*/&
                           LABEL_HEIGHT, &
                           BORDER_LOWERED}) + CString.SPACE
      
      //increment Y
      ll_y += ll_increment
   NEXT

   //determine ideal width
   w_tmp_resource lw
   
   OPEN(lw)
   FOR n = 1 to ll_count
      ll_len = lw.of_gettextwidth(ls_text[n]) + 24
      IF ll_len > ll_labellen THEN ll_labellen = ll_len + 24
   NEXT
   CLOSE(lw)
   //set the ideal width of all labels
   ls_mod = lnv_str.of_Format(ls_mod, {STRING(ll_labellen)})
   //set the ideal X and width for columns
   ll_colx = ll_labellen + LONG(COLUMN_PAD_X) + LONG(LABEL_POS_X)
   IF apo.TypeOf() = Datawindow! THEN
      //compute ideal width based on dw width
      Datawindow ldw
      ldw = apo
      ll_colwidth = ldw.width - (ll_colx)// + (LONG(LABEL_POS_X)))
   ELSE
      ll_colwidth = 500
   END IF
   ls_colmod = lnv_str.of_Format(ls_colmod, {STRING(ll_colx), STRING(ll_colwidth)})
   
   //set detail height
   ls_mod += " Datawindow.Detail.Height=" + STRING(ll_y + ll_increment)
   //apply modstring
   ls_tmp = lds.Modify(ls_mod)
   IF of_IsErrorString(ls_tmp) THEN
      MessageBox("Error on Modify", ls_tmp)
   END IF
   ls_tmp = lds.Modify(ls_colmod)
   IF of_IsErrorString(ls_tmp) THEN
      MessageBox("Error on Modify", ls_tmp)
   END IF

   //now clone the column's properties
   FOR n = 1 to ll_count
      of_CloneColumn(apo, lds, ls_vcolnames[n])
   NEXT

   //tab orders
   ls_tmp = of_GetTabsequence(anv_svc, apo)
   of_SetTabsequence(anv_svc, lds, ls_tmp)

   //we're done, get the syntax
   ls_syntax = lds.Describe("Datawindow.Syntax")
END IF

DESTROY lds

RETURN ls_syntax
end function

protected function integer of_lookupindex (readonly string as_stringarray[], readonly string as_searchvalue);//===========================================================================
// Function: of_Lookupindex (public )
// Object: n_svc_dwmaker
//---------------------------------------------------------------------------
// Description:
// Note:
//---------------------------------------------------------------------------
// Parameters:
//  readonly String as_stringarray[]
//  readonly String as_searchvalue
//---------------------------------------------------------------------------
// Returns: Integer
//---------------------------------------------------------------------------
// Author: (Yeyi) Gabriel B. Abulencia
//===========================================================================

long ll_count, n

ll_count = UPPERBOUND(as_stringarray)
FOR n = 1 to ll_count
   IF as_stringarray[n] = as_searchvalue THEN RETURN n
NEXT

RETURN CREt.FAILURE
end function

public subroutine of_clonecolumn (readonly powerobject apo_source, readonly powerobject apo_clone, readonly string as_colname);//===========================================================================
// Function: of_Clonecolumn (public )
// Object: n_svc_dwmaker
//---------------------------------------------------------------------------
// Description:
// Note:
//---------------------------------------------------------------------------
// Parameters:
//  readonly PowerObject apo_source
//  readonly PowerObject apo_clone
//  readonly String as_colname
//---------------------------------------------------------------------------
// Returns: (none)
//---------------------------------------------------------------------------
// Author: (Yeyi) Gabriel B. Abulencia
//===========================================================================

string ls_style, ls_tmp, ls_mod

ls_style = of_GetColumneditstyle(apo_source, as_colname)

CHOOSE CASE ls_style
   CASE CDWEdit.EDIT
      //required
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".Edit.Required")
      IF NOT of_IsErrorString(ls_tmp) THEN &
      ls_mod += as_colname + '.Edit.Required="' + ls_tmp + '"' + CString.SPACE
      //display only
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".Edit.DisplayOnly")
      ls_mod += as_colname + '.Edit.DisplayOnly="' + ls_tmp + '"' + CString.SPACE
      //format
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".Edit.Format")
      IF NOT of_IsErrorString(ls_tmp) THEN &
      ls_mod += as_colname + '.Edit.Format="' + ls_tmp + '"' + CString.SPACE
      //limit
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".Edit.Limit")
      ls_mod += as_colname + '.Edit.Limit=' + ls_tmp + CString.SPACE
      //password
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".Edit.Password")
      ls_mod += as_colname + '.Edit.Password="' + ls_tmp + '"' + CString.SPACE
      //auto select
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".Edit.AutoSelect")
      ls_mod += as_colname + '.Edit.AutoSelect="' + ls_tmp + '"' + CString.SPACE
      //focus rectangle
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".Edit.FocusRectangle")
      ls_mod += as_colname + '.Edit.FocusRectangle="' + ls_tmp + '"' + CString.SPACE
   CASE CDWEdit.EDITMASK
      //required
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".EditMask.Required")
      ls_mod += as_colname + '.EditMask.Required="' + ls_tmp + '"' + CString.SPACE
      //read only
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".EditMask.ReadOnly")
      ls_mod += as_colname + '.EditMask.ReadOnly="' + ls_tmp + '"' + CString.SPACE
      //mask
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".EditMask.Mask")
      ls_mod += as_colname + '.EditMask.Mask="' + ls_tmp + '"' + CString.SPACE
      //spin
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".EditMask.Spin")
      ls_mod += as_colname + '.EditMask.Spin="' + ls_tmp + '"' + CString.SPACE
      //SpinIncrement
      IF lower(ls_tmp) = YES THEN
         ls_tmp = apo_source.DYNAMIC Describe(as_colname +".EditMask.SpinIncr")
         ls_mod += as_colname + '.EditMask.SpinIncr=' + ls_tmp + CString.SPACE
      END IF
      //Use Format
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".EditMask.UseFormat")
      ls_mod += as_colname + '.EditMask.UseFormat="' + ls_tmp + '"' + CString.SPACE
      //focus rectangle
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".EditMask.FocusRectangle")
      ls_mod += as_colname + '.EditMask.FocusRectangle="' + ls_tmp + '"' + CString.SPACE
   CASE CDWEdit.DDLB
   CASE CDWEdit.DDDW
      //Name
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".DDDW.Name")
      ls_mod += as_colname + '.DDDW.Name="' + ls_tmp + '"' + CString.SPACE
      //DataColumn
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".DDDW.DataColumn")
      ls_mod += as_colname + '.DDDW.DataColumn="' + ls_tmp + '"' + CString.SPACE
      //DisplayColumn
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".DDDW.DisplayColumn")
      ls_mod += as_colname + '.DDDW.DisplayColumn="' + ls_tmp + '"' + CString.SPACE
      //HScrollBar
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".DDDW.HScrollBar")
      ls_mod += as_colname + '.DDDW.HScrollBar="' + ls_tmp + '"' + CString.SPACE
      //VScrollBar
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".DDDW.VScrollBar")
      ls_mod += as_colname + '.DDDW.VScrollBar="' + ls_tmp + '"' + CString.SPACE
      //UseAsBorder
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".DDDW.UseAsBorder")
      ls_mod += as_colname + '.DDDW.UseAsBorder="' + ls_tmp + '"' + CString.SPACE
      //AllowEdit
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".DDDW.AllowEdit")
      ls_mod += as_colname + '.DDDW.AllowEdit="' + ls_tmp + '"' + CString.SPACE
      //Required
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".DDDW.Required")
      ls_mod += as_colname + '.DDDW.Required="' + ls_tmp + '"' + CString.SPACE
      //AutoRetrieve
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".DDDW.AutoRetrieve")
      ls_mod += as_colname + '.DDDW.AutoRetrieve="' + ls_tmp + '"' + CString.SPACE
   CASE CDWEdit.CHKBOX
      //3D
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".CheckBox.3D")
      ls_mod += as_colname + '.CheckBox.3D="' + ls_tmp + '"' + CString.SPACE     
      //On
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".CheckBox.On")
      ls_mod += as_colname + '.CheckBox.On="' + ls_tmp + '"' + CString.SPACE     
      //Off
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".CheckBox.Off")
      ls_mod += as_colname + '.CheckBox.Off="' + ls_tmp + '"' + CString.SPACE    
      //Scale
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".CheckBox.Scale")
      ls_mod += as_colname + '.CheckBox.Scale="' + ls_tmp + '"' + CString.SPACE     
      //Text
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".CheckBox.Text")
      IF ls_tmp <> CString.EMPTY AND NOT ISNULL(ls_tmp) THEN
         //hide the label
         ls_mod += as_colname + "_t.Visible=0" + CString.SPACE
         ls_mod += as_colname + '.CheckBox.Text="' + ls_tmp + '"' + CString.SPACE      
      END IF
      //border
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".Border")
      ls_mod += as_colname + '.Border=' + ls_tmp + CString.SPACE     
   CASE CDWEdit.RADIOBUTTON
      //3D
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".RadioButtons.3D")
      ls_mod += as_colname + '.RadioButtons.3D="' + ls_tmp + '"' + CString.SPACE    
      //Columns
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".RadioButtons.Columns")
      ls_mod += as_colname + '.RadioButtons.Columns=' + ls_tmp + CString.SPACE      
      //Scale
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".RadioButtons.Scale")
      ls_mod += as_colname + '.RadioButtons.Scale="' + ls_tmp + '"' + CString.SPACE    
      //CodeTable
      ls_tmp = apo_source.DYNAMIC Describe(as_colname +".Values")
      ls_mod += as_colname + ".Values='" + ls_tmp + "'" + CString.SPACE    
END CHOOSE

apo_clone.DYNAMIC Modify(ls_mod)
end subroutine

protected function string of_stripquotes (readonly string as_string);//===========================================================================
// Function: of_Stripquotes (public )
// Object: n_svc_dwmaker
//---------------------------------------------------------------------------
// Description:
// Note:
//---------------------------------------------------------------------------
// Parameters:
//  readonly String as_string
//---------------------------------------------------------------------------
// Returns: String
//---------------------------------------------------------------------------
// Author: (Yeyi) Gabriel B. Abulencia
//===========================================================================
string ls_ret

ls_ret = TRIM(as_string)

IF LEFT(ls_ret, 1) = '"' AND RIGHT(ls_ret, 1) = '"' THEN
   ls_ret = MID(ls_ret, 2, LEN(ls_ret) - 2)
END IF

RETURN ls_ret
end function

public function string of_makedwformretrieval (ref n_svc_mgr anv_svc, readonly powerobject apo, readonly powerobject apo_destination);//===========================================================================
// Function: of_Makedwformretrieval (public )
// Object: n_svc_dwmaker
//---------------------------------------------------------------------------
// Description:
// Note:
//---------------------------------------------------------------------------
// Parameters:
//  reference n_svc_mgr anv_svc
//  readonly PowerObject apo
//  readonly PowerObject apo_destination
//---------------------------------------------------------------------------
// Returns: String
//---------------------------------------------------------------------------
// Author: (Yeyi) Gabriel B. Abulencia
//===========================================================================
string ls_syntax, ls_colnames[], ls_datatypes[]
string ls_error, ls_tmp, ls_name, ls_mod, ls_colmod, ls_text[]
n_ds lds
long ll_count, n, ll_colwidth, ll_colx
long ll_y, ll_increment, ll_labellen, ll_len
n_svc_string lnv_str
w_tmp_resource lw

IF NOT of_IsServicableobject(apo) THEN RETURN CString.EMPTY

//create the syntax for columns
ll_count = of_GetRetrievalarguments(anv_svc, apo, ls_colnames, ls_datatypes)

IF ll_count <= 0 THEN RETURN CString.EMPTY

//fix data types
FOR n = 1 to ll_count
   CHOOSE CASE ls_datatypes[n]
      CASE "string"
         ls_datatypes[n] = "char(255)"
   END CHOOSE
NEXT

ls_syntax = of_MakeDW(anv_svc, ls_colnames, ls_datatypes)

//create datastore
lds = CREATE n_ds
lds.Create(ls_syntax, ls_error)
IF ls_error <> CString.EMPTY THEN
   //error on create
   ls_syntax = CString.EMPTY
ELSE
   anv_svc.of_LoadSvc(lnv_str, CSvc.STRING)
   
   ll_increment = (LONG(LABEL_PAD_Y) + LONG(LABEL_HEIGHT))
   ll_y = LONG(LABEL_PAD_Y) + 24
   FOR n = 1 to ll_count
      //check the source for label identified by "<colname>_t"
      ls_name = ls_colnames[n] + "_t"
      ls_tmp = of_MakeFriendlyName(ls_colnames[n]) + ":"
      
      //store text
      ls_text[n] = ls_tmp
      
      //label
      /* 1=name, 2=Text, 3=x, 4=y, 5=width, 6=height */
      ls_mod += "CREATE " + &
            lnv_str.of_Format(LABEL_CONTROL, { &
                           ls_name, &
                           ls_tmp, &
                           LABEL_POS_X, &
                           STRING(ll_y), &
                           "{1}", /*use marker for changing width*/&
                           LABEL_HEIGHT}) + CString.SPACE
      
      //column
      /* 1=name, 2=ID, 3=x, 4=y, 5=width, 6=height, 7=border */
      ls_colmod += "CREATE " + &
            lnv_str.of_Format(COL_CONTROL, { &
                           ls_colnames[n], &
                           STRING(n), /* colID */&
                           "{1}", /*use marker for changing X*/&
                           STRING(ll_y), &
                           "{2}", /*use marker for changing width*/&
                           LABEL_HEIGHT, &
                           BORDER_LOWERED}) + CString.SPACE
      
      //increment Y
      ll_y += ll_increment
   NEXT

   
   //determine ideal width
   IF NOT ISVALID(lw) THEN OPEN(lw)
   FOR n = 1 to ll_count
      ll_len = lw.of_gettextwidth(ls_text[n]) + 48
      IF ll_len > ll_labellen THEN ll_labellen = ll_len
   NEXT
   
   //set the ideal width of all labels
   ls_mod = lnv_str.of_Format(ls_mod, {STRING(ll_labellen)})
   //set the ideal X and width for columns
   ll_colx = ll_labellen + (LONG(COLUMN_PAD_X) + LONG(LABEL_POS_X))
// IF ISVALID(apo_destination) THEN
//    IF apo_destination.TypeOf() = Datawindow! THEN
//       //compute ideal width based on dw width
//       Datawindow ldw
//       ldw = apo
//       ll_colwidth = ldw.width - (ll_colx + (LONG(LABEL_POS_X) * 5))
//    ELSE
//       ll_colwidth = 500
//    END IF
// ELSE
      ll_colwidth = 50
// END IF
   ls_colmod = lnv_str.of_Format(ls_colmod, {STRING(ll_colx), STRING(ll_colwidth)})
   
   //set detail height
   ls_mod += " Datawindow.Detail.Height=" + STRING(ll_y + ll_increment)
   //apply modstring
   ls_tmp = lds.Modify(ls_mod)
   IF of_IsErrorString(ls_tmp) THEN
      MessageBox("Error on Modify", ls_tmp)
   END IF
   ls_tmp = lds.Modify(ls_colmod)
   IF of_IsErrorString(ls_tmp) THEN
      MessageBox("Error on Modify", ls_tmp)
   END IF
   
   //make all required, autoselect
   ls_mod = CString.EMPTY
   FOR n = 1 to ll_count
      ls_mod += ls_colnames[n] + '.Edit.Required="Yes" '
      ls_mod += ls_colnames[n] + '.Edit.AutoSelect="Yes" '
   NEXT
   
   lds.Modify(ls_mod)

   //we're done, get the syntax
   ls_syntax = lds.Describe("Datawindow.Syntax")
END IF

DESTROY lds
IF ISVALID(lw) THEN CLOSE(lw)

RETURN ls_syntax
end function

public function string of_makedwformretrieval (ref n_svc_mgr anv_svc, readonly powerobject apo);//===========================================================================
// Function: of_Makedwformretrieval (public )
// Object: n_svc_dwmaker
//---------------------------------------------------------------------------
// Description:
// Note:
//---------------------------------------------------------------------------
// Parameters:
//  reference n_svc_mgr anv_svc
//  readonly PowerObject apo
//---------------------------------------------------------------------------
// Returns: String
//---------------------------------------------------------------------------
// Author: (Yeyi) Gabriel B. Abulencia
//===========================================================================
powerobject lpo

RETURN of_makedwformretrieval(anv_svc, apo, lpo)
end function

on n_svc_dwmaker.create
call super::create
end on

on n_svc_dwmaker.destroy
call super::destroy
end on