Rowset X cSeek
-
- Posts: 128
- Joined: Tue Mar 20, 2007 3:13 pm
- Has thanked: 1 time
Rowset X cSeek
Hello guys,
I wonder if the behavior of xbrowse this correct in the following situation:
When running rowset the browser mounts with X record, so far so good. But if you run a seek and it finds 4 records that meet the seek, when trying to edit (EditSource ()) Any of the 4 record it only edits the first record.
Thank you so much for your help.
Att.,
Oliveiros Junior
I wonder if the behavior of xbrowse this correct in the following situation:
When running rowset the browser mounts with X record, so far so good. But if you run a seek and it finds 4 records that meet the seek, when trying to edit (EditSource ()) Any of the 4 record it only edits the first record.
Thank you so much for your help.
Att.,
Oliveiros Junior
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Rowset X cSeek
EditSource() edits the current record. Current record means the record which is highlighted in the browse.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
-
- Posts: 128
- Joined: Tue Mar 20, 2007 3:13 pm
- Has thanked: 1 time
Re: Rowset X cSeek
Hello Mr. Rao,
Thanks for the answer.
Would it be possible to send an example to your personal email?
I'm sorry I don't know how to insert images here.
I'm going to put down the routine code.
RowSet
cComando_SQL := "SELECT ocorrencia.escola_ocorrencia, ocorrencia_matricula, ocorrencia dia ocorrência, ocorrencia.observacao," + ;
" ocorrência.situacao, aluno.nome_aluno," + ;
" tabocorrencia.descricao FROM `ocorrencia` JOIN aluno ON" + ;
" aluno.matricula = ocorrencia.matricula" + ;
" LEFT JOIN tabocorrencia on tabocorrencia.codigo = ocorrencia.ocorrencia" + ;
" WHERE `escola_ocorrencia` = ? AND `dia_ocorrencia` BETWEEN ? AND ?" + ;
" ORDER BY dia_ocorrencia DESC"
oOcorrencia := oConexao:RowSet( cComando_SQL, { oSistema():cEscola_Usuario, ;
dData_Inicio, dData_Final } )
Browser
// Browse
*----------------------------------------------------------------------------*
@ 100,260 XBROWSE oBrowse OF oDialog:oDlg SIZE ;
oDialog:nRight - 280, oDialog:nBottom - 140 PIXEL;
DATASOURCE oOcorrencia NOBORDER
WITH OBJECT oBrowse
:nTop := 80
:nLeft := 260
:nBottom := ( oDialog:oDlg:nBottom )- 50
:nRight := ( oDialog:oDlg:nRight ) - 20
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:nColDividerStyle := LINESTYLE_BLACK
:nRowDividerStyle := LINESTYLE_BLACK
:lColDividerComplete := .T.
:lUpdate := .T.
:bClrStd := {|| { CLR_BLACK, IIf( oBrowse:KeyNo() % 3 > 0, CLR_WHITE, ;
IIf( oBrowse:KeyNo() % 3 = 0 .And. oBrowse:KeyNo() % 2 = 0 , ;
nRGB( 238, 238, 238 ), nRGB( 238, 246, 255 ) ) ) } }
:bClrSel := {|| { CLR_BLACK, nRGB( 190, 190, 190 ) } }
:bClrSelFocus := {|| { CLR_BLACK, nRGB( 214, 231, 192 ) } }
:lFooter := .T.
:nFooterLines := 1
:bEdit := { | oRec | Editar_Ocorrencia( oRec ) }
:bLDblClick := { || oBrowse:EditSource() }
:lIncrFilter := .T.
:lSeekWild := .T.
:cFilterFld := "nome_aluno"
// To rebuild the browser if you clear the query say
:bKeyDown := { || If( Empty( oBrowse:cSeek ), ;
( oOcorrencia:ReQuery( { oSistema():cEscola_Usuario, ;
dData_Inicio, dData_Final } ), ;
oBrowse:Refresh(), ;
oBrowse:SetFocus() ), ) }
END
oCol:= oBrowse:AddCol()
oCol:nWidth := 30
oCol:cHeader := "Situação"
oCol:oHeaderFont := oSistema():oFonte8
oCol:nHeadStrAlign := AL_CENTER
oCol:AddResource( "ATIVO" )
oCol:AddResource( "INATIVO" )
oCol:bBmpData := { || IIf( oOcorrencia:situacao, 2, 1 ) }
oCol:= oBrowse:AddCol()
oCol:nWidth := 80
oCol:cHeader := "Dia"
oCol:oHeaderFont := oSistema():oFonte4
oCol:nHeadStrAlign := AL_CENTER
oCol:bStrData := { || oOcorrencia:dia_ocorrencia }
oCol:oDataFont := oSistema():oFonte3
oCol:nDataStrAlign := AL_CENTER
oCol:cFooter := "Registros:"
oCol:nFootStrAlign := AL_CENTER
oCol:= oBrowse:AddCol()
oCol:nWidth := 80
oCol:cHeader := "Matricula"
oCol:oHeaderFont := oSistema():oFonte4
oCol:nHeadStrAlign := AL_CENTER
oCol:bStrData := { || Transform( oOcorrencia:matricula, "@R 999999-9" ) }
oCol:oDataFont := oSistema():oFonte3
oCol:nDataStrAlign := AL_CENTER
oCol:bFooter := { || Transform( oOcorrencia:RecCount(), "@R 9,999,999,999" ) }
oCol:nFootStrAlign := AL_CENTER
oCol:= oBrowse:AddCol()
oCol:nWidth := 300
oCol:cHeader := "Nome"
oCol:oHeaderFont := oSistema():oFonte4
oCol:nHeadStrAlign := AL_CENTER
oCol:bStrData := { || oOcorrencia:nome_aluno }
oCol:oDataFont := oSistema():oFonte3
oCol:nDataStrAlign := AL_LEFT
oCol:= oBrowse:AddCol()
oCol:nWidth := 300
oCol:cHeader := "Ocorrência"
oCol:oHeaderFont := oSistema():oFonte4
oCol:nHeadStrAlign := AL_CENTER
oCol:bStrData := { || oOcorrencia:descricao }
oCol:oDataFont := oSistema():oFonte3
oCol:nDataStrAlign := AL_LEFT
oBrowse:CreateFromCode()
Seek
@ oDialog:oDlg:nTop + 50,570 SAY oBrowse:oSeek PROMPT oBrowse:cSeek SIZE 300,20 PIXEL ;
OF oDialog:oDlg COLOR CLR_BLACK, CLR_WHITE PICTURE '@!' FONT oSistema():oFonte7
Att.,
Oliveiros Junior
Thanks for the answer.
Would it be possible to send an example to your personal email?
I'm sorry I don't know how to insert images here.
I'm going to put down the routine code.
RowSet
cComando_SQL := "SELECT ocorrencia.escola_ocorrencia, ocorrencia_matricula, ocorrencia dia ocorrência, ocorrencia.observacao," + ;
" ocorrência.situacao, aluno.nome_aluno," + ;
" tabocorrencia.descricao FROM `ocorrencia` JOIN aluno ON" + ;
" aluno.matricula = ocorrencia.matricula" + ;
" LEFT JOIN tabocorrencia on tabocorrencia.codigo = ocorrencia.ocorrencia" + ;
" WHERE `escola_ocorrencia` = ? AND `dia_ocorrencia` BETWEEN ? AND ?" + ;
" ORDER BY dia_ocorrencia DESC"
oOcorrencia := oConexao:RowSet( cComando_SQL, { oSistema():cEscola_Usuario, ;
dData_Inicio, dData_Final } )
Browser
// Browse
*----------------------------------------------------------------------------*
@ 100,260 XBROWSE oBrowse OF oDialog:oDlg SIZE ;
oDialog:nRight - 280, oDialog:nBottom - 140 PIXEL;
DATASOURCE oOcorrencia NOBORDER
WITH OBJECT oBrowse
:nTop := 80
:nLeft := 260
:nBottom := ( oDialog:oDlg:nBottom )- 50
:nRight := ( oDialog:oDlg:nRight ) - 20
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:nColDividerStyle := LINESTYLE_BLACK
:nRowDividerStyle := LINESTYLE_BLACK
:lColDividerComplete := .T.
:lUpdate := .T.
:bClrStd := {|| { CLR_BLACK, IIf( oBrowse:KeyNo() % 3 > 0, CLR_WHITE, ;
IIf( oBrowse:KeyNo() % 3 = 0 .And. oBrowse:KeyNo() % 2 = 0 , ;
nRGB( 238, 238, 238 ), nRGB( 238, 246, 255 ) ) ) } }
:bClrSel := {|| { CLR_BLACK, nRGB( 190, 190, 190 ) } }
:bClrSelFocus := {|| { CLR_BLACK, nRGB( 214, 231, 192 ) } }
:lFooter := .T.
:nFooterLines := 1
:bEdit := { | oRec | Editar_Ocorrencia( oRec ) }
:bLDblClick := { || oBrowse:EditSource() }
:lIncrFilter := .T.
:lSeekWild := .T.
:cFilterFld := "nome_aluno"
// To rebuild the browser if you clear the query say
:bKeyDown := { || If( Empty( oBrowse:cSeek ), ;
( oOcorrencia:ReQuery( { oSistema():cEscola_Usuario, ;
dData_Inicio, dData_Final } ), ;
oBrowse:Refresh(), ;
oBrowse:SetFocus() ), ) }
END
oCol:= oBrowse:AddCol()
oCol:nWidth := 30
oCol:cHeader := "Situação"
oCol:oHeaderFont := oSistema():oFonte8
oCol:nHeadStrAlign := AL_CENTER
oCol:AddResource( "ATIVO" )
oCol:AddResource( "INATIVO" )
oCol:bBmpData := { || IIf( oOcorrencia:situacao, 2, 1 ) }
oCol:= oBrowse:AddCol()
oCol:nWidth := 80
oCol:cHeader := "Dia"
oCol:oHeaderFont := oSistema():oFonte4
oCol:nHeadStrAlign := AL_CENTER
oCol:bStrData := { || oOcorrencia:dia_ocorrencia }
oCol:oDataFont := oSistema():oFonte3
oCol:nDataStrAlign := AL_CENTER
oCol:cFooter := "Registros:"
oCol:nFootStrAlign := AL_CENTER
oCol:= oBrowse:AddCol()
oCol:nWidth := 80
oCol:cHeader := "Matricula"
oCol:oHeaderFont := oSistema():oFonte4
oCol:nHeadStrAlign := AL_CENTER
oCol:bStrData := { || Transform( oOcorrencia:matricula, "@R 999999-9" ) }
oCol:oDataFont := oSistema():oFonte3
oCol:nDataStrAlign := AL_CENTER
oCol:bFooter := { || Transform( oOcorrencia:RecCount(), "@R 9,999,999,999" ) }
oCol:nFootStrAlign := AL_CENTER
oCol:= oBrowse:AddCol()
oCol:nWidth := 300
oCol:cHeader := "Nome"
oCol:oHeaderFont := oSistema():oFonte4
oCol:nHeadStrAlign := AL_CENTER
oCol:bStrData := { || oOcorrencia:nome_aluno }
oCol:oDataFont := oSistema():oFonte3
oCol:nDataStrAlign := AL_LEFT
oCol:= oBrowse:AddCol()
oCol:nWidth := 300
oCol:cHeader := "Ocorrência"
oCol:oHeaderFont := oSistema():oFonte4
oCol:nHeadStrAlign := AL_CENTER
oCol:bStrData := { || oOcorrencia:descricao }
oCol:oDataFont := oSistema():oFonte3
oCol:nDataStrAlign := AL_LEFT
oBrowse:CreateFromCode()
Seek
@ oDialog:oDlg:nTop + 50,570 SAY oBrowse:oSeek PROMPT oBrowse:cSeek SIZE 300,20 PIXEL ;
OF oDialog:oDlg COLOR CLR_BLACK, CLR_WHITE PICTURE '@!' FONT oSistema():oFonte7
Att.,
Oliveiros Junior
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Rowset X cSeek
my email: nageswaragunupudi [at] gmail [dot] com
Some suggestions on creation of XBrowse:
Creating columns using :AddCol(), :bStrData(), etc is obsolete and deprecated many years back. This way you will not be able to avail the full power and xbrowse. We recommend creating by command syntax using COLUMNS clause.
I give you two alternatives:
Alternative-1
Alternative-2
Both the above alternatives are functionally equivalent. You may use either one of them depending on your choice and what do you think is clearer to you and easier to understand and maintain.
After defining the main part of the browse using any of the two methods above, proceed with the next part:
Done.
"LINES" clause is equivalent to these lines:
This part of the code may not be necessary, because xbrowse automatically does the same thing.
Please feel free to ask for any clarifications.
Some suggestions on creation of XBrowse:
Creating columns using :AddCol(), :bStrData(), etc is obsolete and deprecated many years back. This way you will not be able to avail the full power and xbrowse. We recommend creating by command syntax using COLUMNS clause.
I give you two alternatives:
Alternative-1
Code: Select all | Expand
@ 80,260 XBROWSE oBrowse SIZE -20,-50 PIXEL OF oDialog:oDlg ;
DATASOURCE oOcorrencia ;
COLUMNS "situacao","dia_ocorrencia","matricula","nome_aluno","descricao" ;
HEADERS "Situação", "Dia", "Matricula", "Nome", "Ocorrência" ;
PICTURES nil, nil, "@R 999999-9" ;
COLSIZES 30, 80, 80, 300, 300 ;
ALIGN AL_CENTER, AL_CENTER, AL_CENTER ;
LINES NOBORDER FOOTERS ;
FONT oSistema():oFonte3 ;
UPDATE
Alternative-2
Code: Select all | Expand
aCols := {
{ "situacao", "Situação", nil, 30, AL_CENTER }, ;
{ "dia_ocorrencia","Dia", nil, 80, AL_CENTER }, ;
{ "Matricula", nil, "@R 999999-9", 80, AL_CENTER }, ;
{ "nome_aluno", "Nome", nil, 300 }, ;
{ "descricao", "Ocorrência", nil, 300 } }
@ 80,260 XBROWSE oBrowse SIZE -20,-50 PIXEL OF oDialog:oDlg ;
DATASOURCE oOcorrencia ;
COLUMNS aCols ;
LINES NOBORDER FOOTERS ;
FONT oSistema():oFonte3 ;
UPDATE
Both the above alternatives are functionally equivalent. You may use either one of them depending on your choice and what do you think is clearer to you and easier to understand and maintain.
After defining the main part of the browse using any of the two methods above, proceed with the next part:
Code: Select all | Expand
WITH OBJECT oBrowse
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:bEdit := { | oRec | Editar_Ocorrencia( oRec ) }
:bLDblClick := { || oBrowse:EditSource() }
:lIncrFilter := .T.
:lSeekWild := .T.
:cFilterFld := "nome_aluno"
:nHeadStrAligns := AL_CENTER // all headers
:oHeaderFonts := oSistema():oFonte4
WITH OBJECT :aCols[ 1 ]
:SetCheck( { "INATIVO", "ATIVO" }, .t. )
:oHeaderFont := oSistema():oFonte8
END
:aCols[ 1 ]:cFooter := "Registros:"
WITH OBJECT :aCols[ 3 ]
:bFooter := { || oBrowse:nLen }
:cFooterPicture := "@E 999,999,999"
END
:CreateFromCode()
END
Done.
"LINES" clause is equivalent to these lines:
Code: Select all | Expand
:nColDividerStyle := LINESTYLE_BLACK
:nRowDividerStyle := LINESTYLE_BLACK
:lColDividerComplete := .T.
This part of the code may not be necessary, because xbrowse automatically does the same thing.
Code: Select all | Expand
:bKeyDown := { || If( Empty( oBrowse:cSeek ), ;
( oOcorrencia:ReQuery( { oSistema():cEscola_Usuario, ;
dData_Inicio, dData_Final } ), ;
oBrowse:Refresh(), ;
oBrowse:SetFocus() ), ) }
Please feel free to ask for any clarifications.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
-
- Posts: 128
- Joined: Tue Mar 20, 2007 3:13 pm
- Has thanked: 1 time
Re: Rowset X cSeek
Hi Mister Rao,
I sent your email an example of the problem.
Thank you.
Oliveiros Junior
I sent your email an example of the problem.
Thank you.
Oliveiros Junior
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
-
- Posts: 128
- Joined: Tue Mar 20, 2007 3:13 pm
- Has thanked: 1 time
Re: Rowset X cSeek
Hello Mr. Rao,
Thank you. If you need to prepare an executable and send.
Att.,
Oliveiros Junior
Thank you. If you need to prepare an executable and send.
Att.,
Oliveiros Junior
-
- Posts: 128
- Joined: Tue Mar 20, 2007 3:13 pm
- Has thanked: 1 time