String  ls_sql_syntax, ls_style, ls_dw_syntax, ls_dw_err
// ´ݴڶǰȼSyntaxǷΪ
IF  mle_1.text = ""  THEN
	MessageBox"Error", " Sorry!  No Syntax Exists. Enter valid SQL or " &
	 + "DataWindow Syntax or Select Table and Columns and then create. "
	Return
END IF
// ݴڶķѡ
ls_style = "styletype = " + is_report_type + "datawindowunits =2  color =12632256"
// mle_1ʾSQLDW Syntax 䴴ݴڶ
IF  rb_sql . Checked  THEN
	ls_sql_syntax = mle_1.Text
		ls_dw_err = ""
		ls_dw_syntax = SyntaxFromSQLsqlca, ls_sql_syntax, ls_style, ls_dw_err
If  ls_dw_err <> ""  Then
		MessageBox" Error ", ls_dw_err
			Return
		End If
	dw_new . Createls_dw_syntax
ELSE
	dw_new . Createmle_1.Text
END IF
// ´ݴڶݣdw_newʾ
dw_new . SetTransObjectSQLCA
dw_new . Retrieve
ݴڿؼdw_tablesClicked¼¼Ϊ
String  is_Table
// ûѡݱ򷵻
IF  row = 0  THEN  Return
// Եʽѡлȥѡ
dw_tables . SelectRow0,  False
dw_tables . SelectRowrow,  True
// ѡлȡݱ
is_Table = dw_tables .GetItemStringrow, 1
// f_set_column_select ( )ΪһûԶ庯 
// úڵǰѡݱֶб
IF  f_set_column_select (dw_columns, is_Table) < 0  THEN
	MessageBox" Error ", " Unable to Set SQL Select statement For Columns list ", StopSign!
	Return
END IF
dw_columns . Retrieve // עf_set_column_select ( )˺ʵı
ݴڿؼdw_columnsClicked¼¼Ϊ
// ûѡݱ򷵻
IF  row = 0  THEN  Return	
// ĳֶαѡУ뵽ѡб
// ֶѾѡУȡѡ״̬
IF  dw_columns . IsSelected( row )  THEN
	dw_columns . SelectRowrow, False
ELSE
	dw_columns . SelectRowrow, True
END IF
// mle_1еʾ
IF  rb_sql .Checked  THEN
	mle_1.Text = wf_build_sql_syntax  // ʹûȡSQLĺ
ELSE
	mle_1.Text = wf_build_dw_syntax  // ʹûȡDW Syntaxĺ
END IF
ѡťrb_1Clicked¼¼Ϊ
// ݴڶʾΪʽ
IF  this .Checked  THEN  is_report_type = "Grid "
// mle_1ʾDW Syntax䣬Ҫµʾʽmle_1е
IF  rb_dwsyntax .Checked  THEN
	rb_dwsyntax .TriggerEvent"Clicked "
END IF
ѡťrb_2Clicked¼¼Ϊ
// ݴڶʾΪбʽ
IF  this .Checked  THEN  is_report_type = " Tabular "
// mle_1ʾDW Syntax䣬Ҫµʾʽmle_1е
IF  rb_dwsyntax .Checked  THEN
	rb_dwsyntax .TriggerEvent"Clicked "
END IF
ѡťrb_3Clicked¼¼Ϊ
// ݴڶʾΪʽ
IF  this .Checked  THEN  is_report_type = " Form "
// mle_1ʾDW Syntax䣬Ҫµʾʽmle_1е
IF  rb_dwsyntax .Checked  THEN
	rb_dwsyntax .TriggerEvent"Clicked "
END IF





//Homework:
ο£
/* 	˵
arg_err_object 	 StringͣĶ
arg_err_code  	 Longָͣ
arr_err_msg		 Stringָͣԭ
*/
Integer li_fileno		// ֲļ
Integer rc
rc=0
li_fileno = FileOpen("C:\Error.log", LineMode!, Write!, Shared!, Append!)
IF  li_fileno<0 THEN 	// ļʧ
MessageBox("־ļ","ܴ־ļ")
Return -1
END IF
IF FileWrite(li_fileno,"~r~n****" + String(Today()) + " " + &
String(Now()) + " "+arg_err_object + &
"룺 " + String(arg_err_code) + &
"Ϣ " + arr_err_msg)<0 THEN	// дļʧ
MessageBox("־ļ","д־ļ")
rc=-2
END IF
IF FileClose(li_fileno)<0 THEN 	// رļʧ
MessageBox("־ļ", "ܹر־ļ")
rc=-3
END IF
Return  rc	// ش״̬
ݴڿؼDBError¼ʹ涨־uf_log()ǾͿԽÿؼصĳϢǼǵ־ļˡ
