How to SCAN substrings in a dbf - Summer 87
Moderador: Moderadores
How to SCAN substrings in a dbf - Summer 87
Hi Alex
Sorry, but I don't understood, what "unpredictable results" may lead ?
I suggest adding SELECT 2 before USE command because when you USE a table without changing current work area, new table will open in the current WA; and after closed the table (if any) reside this area. This is because further references to CASES alias produce "Alias not found" error.
New versions of Clipper ( after S87) have "NEW" keyword in USE command and SELECT 0 for "first empty /avaliable work area"; but in S87 we should define new work area by using SELECT command; I think.
Regards
Sorry, but I don't understood, what "unpredictable results" may lead ?
I suggest adding SELECT 2 before USE command because when you USE a table without changing current work area, new table will open in the current WA; and after closed the table (if any) reside this area. This is because further references to CASES alias produce "Alias not found" error.
New versions of Clipper ( after S87) have "NEW" keyword in USE command and SELECT 0 for "first empty /avaliable work area"; but in S87 we should define new work area by using SELECT command; I think.
Regards
-
marge0512
- Usuário Nível 3

- Mensagens: 121
- Registrado em: 20 Mai 2011 12:42
- Localização: United States
How to SCAN substrings in a dbf - Summer 87
Here is the code that brings the system to choosing CO_FND:
Does this help any??
Código: Selecionar todos
*------------------------------------------------------------------------------*
* File......: MAIN.PRG
* Date......: 4/16/90
* Purpose...: CASES.DBF maintenance
* *------------------------------------------------------------------------------*
private HEADING1, HEADING2, LAYOUT
external ZTRIM, CSTR
* Open database, return if fails
*-------------------------------
if .not. USE_DBFS( "CASES, CAS_NAME, CAS_NAM2")
return
endif
select CASES
* Set up for U_READ
*------------------
do VAR_INIT
* Present ADD option if database is empty
*----------------------------------------
EMPTY_DB = .F.
BM_SELECT = 0
FIRST_TIME = .T.
OP_CL_ALL = 'A'
BM_SIZE = iif(ACCESS='S',6,3)
go top
* Loop until the 7th choice of the menu is chosen (Quit)
*-------------------------------------------------------
do while BM_SELECT <> BM_SIZE
* Display borders
*----------------
do BORDERS with "BROWSE DATABASE"
* If the database is empty, let the user add a record
*----------------------------------------------------
if eof()
* Give user opportunity to add a record
*--------------------------------------
EMPTY_DB = .T.
OP_CL_ALL = 'A'
if YES_TO( "The database is empty. Add now? ")
do SAV_SCRN
do CO_ADD
do RST_SCRN
endif
* If user didn't want to add, or abandoned add, return
*-----------------------------------------------------
if EMPTY_DB
close data
return
endif
endif
* Set up menu
*------------
*0....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....
* Add Update Delete Inquire Find Quit
if ACCESS = 'S'
if OP_CL_ALL = 'C'
BM_1 = "2300A Add "
BM_2 = "2305U Update "
BM_3 = "2313D Delete "
BM_4 = "2321I Inquire "
BM_5 = "2330F Find "
BM_6 = "2336O Open/Closed/All "
BM_7 = "2353Q Quit "
else
BM_1 = "2300A Add "
BM_2 = "2305U Update "
BM_3 = "2313I Inquire "
BM_4 = "2322F Find "
BM_5 = "2328O Open/Closed/All "
BM_6 = "2345Q Quit "
endif
else
BM_1 = "2300I Inquire "
BM_2 = "2309F Find "
BM_3 = "2315Q Quit "
endif
* Display menu & force return
*----------------------------
keyboard chr( ESC_KEY)
U_MENU( "BM_", BM_SELECT, BM_SIZE, "", 1)
* Display headings & prompt & browse the database
*------------------------------------------------
do DISP_MSG with BROWSE_MSG
set color to &LBL_CLR
@ SCRL_T-1, SCRL_L say HEADING1
do U_SCROLL with SCRL_T, SCRL_L, SCRL_B, SCRL_R, LAYOUT, "CO_MENU"
enddo
* Return
*-------
close data
return
*
*-----------------------------------------------------------------------------*
* MAIN.PRG: CO_MENU The menu routine for the CASES BROWSE screen
* scroll
*-----------------------------------------------------------------------------*
procedure CO_MENU
private KEY_CHAR
* Save browse screen
*-------------------
DO SAV_SCRN
* Menu
*-----
KEY_CHAR = SCRL_MNU( "BM_", BM_OPTIONS, @BM_SELECT)
* Act on menu selection
*----------------------
do case
case KEY_CHAR = "Q"
do SCRL_RET
case KEY_CHAR = "A"
do CO_ADD
case KEY_CHAR = "U"
do CO_UPD
case KEY_CHAR = "D"
do CO_DEL
case KEY_CHAR = "I"
do CO_INQ
case KEY_CHAR = "O"
do CO_TOG
do SCRL_RET
case KEY_CHAR = "F"
do CO_FND
endcase
* Restore browse screen, update menu display
*-------------------------------------------
if KEY_CHAR $ " QO"
do DIS_SCRN
else
do RST_SCRN
keyboard chr( ESC_KEY)
U_MENU( "BM_", BM_SELECT, BM_SIZE, "", 1)
endif
return
*
How to SCAN substrings in a dbf - Summer 87
Amigo, please look at here :Pablo César escreveu:I think "!" beguns after 5.0
http://www.ousob.com/ng/sum87/ng5ebcc.php
Regards
- Pablo César
- Usuário Nível 7

- Mensagens: 5312
- Registrado em: 31 Mai 2006 10:22
- Localização: Curitiba - Paraná
How to SCAN substrings in a dbf - Summer 87
Marge how i you USE_DBFS function ? Could you list your code for us ?
Sorry, I thought "!" is begins to use at Clipper 5 version.esgici escreveu:Amigo, please look at here :Pablo César escreveu:I think "!" beguns after 5.0
http://www.ousob.com/ng/sum87/ng5ebcc.php
Regards
Um clip-abraço !
Pablo César Arrascaeta
Compartilhe suas dúvidas e soluções com todos os colegas aqui do fórum.
Evite enviar as dúvidas técnicas por MPs ou eMails, assim todos iremos beneficiar-nos.
Pablo César Arrascaeta
Compartilhe suas dúvidas e soluções com todos os colegas aqui do fórum.
Evite enviar as dúvidas técnicas por MPs ou eMails, assim todos iremos beneficiar-nos.
-
marge0512
- Usuário Nível 3

- Mensagens: 121
- Registrado em: 20 Mai 2011 12:42
- Localização: United States
How to SCAN substrings in a dbf - Summer 87
Sure, I'm surprised that I found the code because things are a mess sometimes. Lol! Here it is:
Código: Selecionar todos
*----------------------------------------------------------------------
* USE_DBFS() Open a list of files & indices
*----------------------------------------------------------------------
function USE_DBFS
parameters P_1, P_2, P_3, P_4, P_5, P_6, P_7, P_8, P_9, P_10, P_11, P_12, P_13, P_14, P_15, P_16, P_17, P_18, P_19, P_20
private I, S, P, DBF, NDX, K, USER_QUIT
USER_QUIT = .F.
I = 1
do while I <= pcount() .and. .not. USER_QUIT
* Get the parm
*-------------
S = ltrim( str( I))
P = alltrim( P_&S)
* Parse out the database & index names
*-------------------------------------
K = at( [,], P)
if K = 0
DBF = P
else
DBF = left( P, K-1)
NDX = right( P, len( P)-K)
endif
* Try and open the files
*-----------------------
select &S
if .not. USE_DBF( DBF)
USER_QUIT = .T.
elseif K <> 0
if .not. USE_NDXS( NDX)
USER_QUIT = .T.
endif
endif
* Next database
*--------------
I = I + 1
enddo
return .not. USER_QUIT
-
alxsts
- Colaborador

- Mensagens: 3092
- Registrado em: 12 Ago 2008 15:50
- Localização: São Paulo-SP-Brasil
How to SCAN substrings in a dbf - Summer 87
Hi!
Marge, before the line: insert the line:
Since we don't not know if a file was open in WA number 2, if we open a table there could cause errors when returning to the caller procedure.esgici escreveu:Sorry, but I don't understood, what "unpredictable results" may lead ?
Yes, you're right. In Summer, as you said, we don't have the NEW clause in the USE command. But we have it's equivalent, as you said also. And this is the solution to the problem.esgici escreveu:when you USE a table without changing current work area, new table will open in the current WA
Marge, before the line:
Código: Selecionar todos
USE tmpTable EXCLUSIVECódigo: Selecionar todos
SELECT 0[]´s
Alexandre Santos (AlxSts)
Alexandre Santos (AlxSts)
-
alxsts
- Colaborador

- Mensagens: 3092
- Registrado em: 12 Ago 2008 15:50
- Localização: São Paulo-SP-Brasil
How to SCAN substrings in a dbf - Summer 87
Hi,
after reading Marge's last post, I must suggest what follows:
replace the 2 occurences of the linewith It's because I don't know what kind of indices you're using. It appears to be .NDX.
after reading Marge's last post, I must suggest what follows:
replace the 2 occurences of the line
Código: Selecionar todos
ERASE tmpTable.ntxCódigo: Selecionar todos
cString = "tmpTable"
ERASE (cString) + IndexExt()
[]´s
Alexandre Santos (AlxSts)
Alexandre Santos (AlxSts)
How to SCAN substrings in a dbf - Summer 87
I said also "open table count + 1".alxsts escreveu:In Summer, as you said, we don't have the NEW clause in the USE command. But we have it's equivalent, as you said also. And this is the solution to the problem.
Anyway, SELECT 0 is better, because with it programmer doesn't should know how many area used at any time.
And, thank to remember; I was not sure if S87 has this usage.
-
marge0512
- Usuário Nível 3

- Mensagens: 121
- Registrado em: 20 Mai 2011 12:42
- Localização: United States
How to SCAN substrings in a dbf - Summer 87
I believe it is .ndx. I will start again tomorrow morning. Again, i am getting compiling errors and I'm not sure what I did so I will have to do "process of elimination" again to correct the problem.
Thanks for everyone's help!!
Thanks for everyone's help!!
- Pablo César
- Usuário Nível 7

- Mensagens: 5312
- Registrado em: 31 Mai 2006 10:22
- Localização: Curitiba - Paraná
How to SCAN substrings in a dbf - Summer 87
I am still not sure of operator use "!" for Summer 87. Not sure this documentation in http://www.ousob.com/ng/sum87/ng5ebcc.php is really Summer 87. Please note file name (php page) ng5ebcc.php (ng ? Only at version 5 appears for first time in Clipper) and 5 ?esgici escreveu:Amigo, please look at here :Pablo César escreveu:I think "!" beguns after 5.0
http://www.ousob.com/ng/sum87/ng5ebcc.php
Regards
Here is also a comment of this operator in version 5, including !EOF() Text extracted from: https://docs.google.com/viewer?a=v&q=ca ... FTCkRl8zBQ
Um clip-abraço !
Pablo César Arrascaeta
Compartilhe suas dúvidas e soluções com todos os colegas aqui do fórum.
Evite enviar as dúvidas técnicas por MPs ou eMails, assim todos iremos beneficiar-nos.
Pablo César Arrascaeta
Compartilhe suas dúvidas e soluções com todos os colegas aqui do fórum.
Evite enviar as dúvidas técnicas por MPs ou eMails, assim todos iremos beneficiar-nos.
How to SCAN substrings in a dbf - Summer 87
Hi Pablo, my dear amigo
); I like much this attitude.
Now, I'm sure that this "!" operator exists in S87 !
First, your extracted text doesn't say "first introduced in Vers. 5"
Second I still have S87 Ref. Guide, and a little quote from there :
And third, our friend Marge still has S87 Compiler, it's very simple a "try and see" test.
By the way, it's very pleasant, for prove that I'm wrong, you are using a quote from my blog
)
Thanks also for this.
Everything is for advance and for learning something new :*
Happy Clippering,
Viva Clipper Language
Definitely, you like "going until to the end" ( like mePablo César escreveu:I am still not sure of operator use "!" for Summer 87. Not sure this documentation in http://www.ousob.com/ng/sum87/ng5ebcc.php is really Summer 87. Please note file name (php page) ng5ebcc.php (ng ? Only at version 5 appears for first time in Clipper) and 5 ?
Here is also a comment of this operator in version 5, including !EOF()
Now, I'm sure that this "!" operator exists in S87 !
First, your extracted text doesn't say "first introduced in Vers. 5"
Second I still have S87 Ref. Guide, and a little quote from there :
And third, our friend Marge still has S87 Compiler, it's very simple a "try and see" test.
By the way, it's very pleasant, for prove that I'm wrong, you are using a quote from my blog
Thanks also for this.
Everything is for advance and for learning something new :*
Happy Clippering,
Viva Clipper Language
- Pablo César
- Usuário Nível 7

- Mensagens: 5312
- Registrado em: 31 Mai 2006 10:22
- Localização: Curitiba - Paraná
How to SCAN substrings in a dbf - Summer 87
First thank you for clarifying all about this matter and for your kind of words. I keep very good feelings motivated by his great strength to help people and his great knowledge in our programming language.
Sorry for all of this inconveniencies.
That is what I was looking for... that´s it !esgici escreveu:Second I still have S87 Ref. Guide
Sorry for all of this inconveniencies.
Um clip-abraço !
Pablo César Arrascaeta
Compartilhe suas dúvidas e soluções com todos os colegas aqui do fórum.
Evite enviar as dúvidas técnicas por MPs ou eMails, assim todos iremos beneficiar-nos.
Pablo César Arrascaeta
Compartilhe suas dúvidas e soluções com todos os colegas aqui do fórum.
Evite enviar as dúvidas técnicas por MPs ou eMails, assim todos iremos beneficiar-nos.
How to SCAN substrings in a dbf - Summer 87
Hi Pablo, my dear amigo
Thank you very much your kind words
Combat of ideas emerges the light of truth !
Viva friendship
)
Thank you very much your kind words
Please, there isn't any "inconvenience", did you remember ?Pablo César escreveu:Sorry for all of this inconveniencies.
Combat of ideas emerges the light of truth !
Viva friendship
-
marge0512
- Usuário Nível 3

- Mensagens: 121
- Registrado em: 20 Mai 2011 12:42
- Localização: United States
How to SCAN substrings in a dbf - Summer 87
Wow! I finally found the compile error and this seems to be working beautifully now! All I can say is.........HAPPY HAPPY JOY JOY!!!!!!!!!!! Thank you so much!!!!
Now, I'm working on how to match the first names with the last names. All of the last names show but the first do not. Time for me to do.........
trial and error! I am starting to see a big smile on my user's face! Lol!
Now, I'm working on how to match the first names with the last names. All of the last names show but the first do not. Time for me to do.........
trial and error! I am starting to see a big smile on my user's face! Lol!
-
marge0512
- Usuário Nível 3

- Mensagens: 121
- Registrado em: 20 Mai 2011 12:42
- Localização: United States
How to SCAN substrings in a dbf - Summer 87
Now, I'm really looking at this code and there are a couple of things that I don't understand. Could someone explain what it happening here:
Thanks in advance!
Código: Selecionar todos
IF LEN(cString) > 0
*something was found, save it.
APPEND BLANK <-----------------Why do we need to APPEND here?
IF .Not. NetErr()
tmpTable->CAS_COMPNY = Cases->CAS_COMPNY
tmpTable->CAS_LNAME = UPPER(cString)
ELSE
*Error. Display some message and Exit
DO DISP_MSG with [Error writing temporary file. Press a key to exit.]
SELECT CASES
Go SAV_REC
RETURN
ENDIF
ENDIF
Cases->(DbSkip()) <--------------What does this statement do?
Also, i know this was the original code our programmer put in here but after researching this I still don't understand what this statement really does:
*-----------------------------------
*Get client index
*-----------------------------------
Set Order to 7 <-------------------
