> >*!* LOAD event of the form > >WITH this > LOCAL cSelectCmd AS String > > cSelectCmd = "SELECT Expr_cli.Expr_cliid, Expr_cli.Expreso, Expr_cli.Clienteid " +; > "FROM Datos!Expr_cli " +; > "WHERE Expr_cli.Clienteid = '0'" > > .Ca("caExpr_cli", "Expr_cli", "curExpr_cli", .T., cSelectCmd, "Expr_cli") > > SELECT curExpr_cli > > cSelectCmd = "SELECT Expresos.expresoid, Expresos.expreso, Expresos.nombre, "+; > "Expresos.direccion, Expresos.localidad, Expresos.provincia, "+; > "Expresos.tele1, Expresos.tele2, Expresos.usuario, Expresos.dt "+; > "FROM expresos "+; > "WHERE DELETED() = .F." > > .Ca("caExpresos", "Expresos", "curExpresos", cSelectCmd, "Expresos") >ENDWITH > > > >*!* Ca method of the form >Lparameters toObjeto, tcTabla, tcAlias, tcSelectCmd, tcListaTablas > >** genera un cursor adapter de una sola tabla, actualizable o no, vacio o no > >Local cSchema as String, cUFL as String, cUNL as String, lOK as Boolean, cSelectCmd as String, cThis as String > >lOK = .T. > >******************************************* >*!* In here it generates the UpdatableFieldList, the UpdateNameList and the CursorSchema using the table for that >Try > > If Vartype(tcSelectCmd) = "C" > cSelectCmd = tcSelectCmd > This.armaschema(tcTabla, cSelectCmd, tcAlias) > cSelectCmd = tcSelectCmd + [ into cursor ] + tcAlias > else > This.OpenTable(tcTabla, tcAlias) && abre la tabla > This.armaschema(tcTabla, '', tcAlias) > endif > >Catch To oException > > lOK = .F. > This.mensaje("No se pudo generar el schema en el cursor " + tcAlias + Chr(13) + oException.Message) > >Endtry > >If lOK = .F. > Return >Endif >**************************************************** > >cUFL = This.cUFL && updatable field list >cUNL = This.cUNL && update name list >cSchema = This.cSch && table schema > >This.CloseTable(tcAlias) && cierra la tabla antes de armar el CA > >lOK = .T. > >Try > If Vartype( "This." + toObjeto ) = "O" > Removeproperty(This, "toObjeto ") > Endif > > This.AddProperty((toObjeto )) > > cCa = "This." + toObjeto + " = Createobject('cursoradapter')" > &cCa > > >Catch To oErrores > > Messagebox("No se pudo generar el objeto CursorAdapter"+; > Chr(13)+oErrores.Message,16,"Atención",2000) > > lOK = .F. > >Finally >Endtry > >If lOK = .F. > Return >Endif > > >If lOK = .T. > Try > > cSelectCmd = tcSelectCmd > > cThis = 'This.' + toObjeto > > cDataSourceType = cThis + '.DataSourceType = "NATIVE"' > cAlias = cThis + '.Alias = "' + tcAlias + '"' > > If Vartype(tcListaTablas) = "C" and Len(Alltrim(tcListaTablas)) > 0 > cTables = cThis + '.Tables = "' + tcListaTablas + '"' > else > cTables = cThis + '.Tables = "' + tcTabla+ '"' > endif > > cDataSourceType = cThis + '.DataSourceType = "NATIVE"' > cAlias = cThis + '.Alias = "' + tcAlias + '"' > cTables = cThis + '.Tables = "' + tcTabla + '"' > cBufferModeOverride = cThis + '.BufferModeOverride = 5' > cKeyFieldList = cThis + '.KeyFieldList = "' + this.cCampoClave + '"' > cSendUpdates = cThis + '.SendUpdates = .T.' > cSelectCmd = cThis + '.SelectCmd = "' + cSelectCmd + '"' > cUpdatableFieldList = cThis + '.UpdatableFieldList = "' + cUFL + '"' > cUpdateNameList = cThis + '.UpdateNameList = "' + cUNL + '"' > cCursorSchema = cThis + '.CursorSchema = "' + cSchema + '"' > cCursorFill = cThis + '.CursorFill()' > > &cDataSourceType > &cAlias > &cTables > &cBufferModeOverride > &cKeyFieldList > &cSendUpdates > &cSelectCmd > &cUpdatableFieldList > &cUpdateNameList > &cCursorSchema > &cCursorFill > > Select ( tcAlias ) > > Catch To oErrores > > Messagebox("No se pudo generar el Cursor "+tcAlias+Chr(13)+oErrores.Message; > ,16,"Atención",3000) > > lOK = .F. > > Endtry >Endif > >Return lOK