Página 4 de 9
Command Needed
Enviado: 23 Jan 2013 18:11
por alxsts
Hi!
If I have understood it, now you have a DbEdit() window showing two columns and what you need is to make it shows one column only, like in the first version. Furthermore, you need to merge in this column the company names or their owners' last names and first names containning the search argument. All this sorted ascending and case insensitive. Ok?
Clipper has been a nice language since it appeared but it's is not a magician. There is no built-in functionality to perform this task automatically. Code must be written.
I think the best solution is to perform a full table scan writing the right records only to our tmpTable. After, you have two choices: SORT or INDEX ON tmpTable. And submit it to the DBedit(), after a few adjusts to it's parameters. Are you ready?
Command Needed
Enviado: 24 Jan 2013 11:20
por marge0512
Well, I'm not sure I'm ready if I'm ready, but I'm sure going to try! Lol!!
In a nutshell, yes, you are correct as to what I need for my system. It's all about pleasing the user. I just wish i knew Clipper well. I'm so used to working with object oriented languages that I have gotten spoiled.
Well, back to my Clipper journey!!
Command Needed
Enviado: 25 Jan 2013 10:22
por Pablo César
I prefer to use TBrowses in place of DbEdit. It is more flexible.
Nota de Moderação:por
Pablo César: This topic is full of different matters. Please marge0512 take in mind for next messages to open a new topic when you need to see different matters and then put differents descriptions at subject of your posts.
Command Needed
Enviado: 25 Jan 2013 12:42
por alxsts
Hi!
TBrowe() does not exist in Clipper Summer' 87.
Command Needed
Enviado: 25 Jan 2013 13:18
por Pablo César
ohhh yeah !
Better to upgrade your tools with Clipper 5 or Harbour, to get more resources and not still suffering so much...
Command Needed
Enviado: 25 Jan 2013 13:27
por marge0512
Hi! I really tried to upgrade to Harbour but it became a total nitemare since there were so many missing libraries. This is going to be hard to believe, but I can debug in Harbour so i use it for that but that's it. I cannot debug in Summer87.
Command Needed
Enviado: 25 Jan 2013 13:35
por Pablo César
Missing libraries to upgrade in Harbour ? Try to use HMG IDE.
See others posts like this:
https://pctoledo.org/forum/viewto ... hmg#p78661
HMG had helped me much to imigrate from Clipper to Harbour. This IDE installation resumes all configurations and avoid many other installations tools. Try it.
Command Needed
Enviado: 25 Jan 2013 13:37
por marge0512
Great! Thank you! That will be my next project.
Command Needed
Enviado: 25 Jan 2013 13:45
por Pablo César
You can try to convert Summer´s project into 32bits...
Of course there is one step left from Summer to Clipper5
You should use Functions, Variables types declarations, includes. But still an excellent option.
Command Needed
Enviado: 25 Jan 2013 16:28
por alxsts
Hi!
marge0512 escreveu:it became a total nitemare since there were so many missing libraries.
I think she means third part libraries that would also be missing using HMG.
The problem was solved, then changes were made by the user to the specification. But the solution is still one step away. To go back now and try to convert to another tool would delay a lot, mainly considering there are missing libraries.
Marge: if you're in trouble to alter the code, tell us. After all this time working with you in this thread, it has became familiar to me. I can easily do this and post if you want me to do.
Command Needed
Enviado: 25 Jan 2013 16:35
por marge0512
Do you think that would be ok? I got this message:
Nota de Moderação:
por Pablo César: This topic is full of different matters. Please marge0512 take in mind for next messages to open a new topic when you need to see different matters and then put differents descriptions at subject of your posts.
Or should I start a new topic?
I have been working with the code and have to admit that I'm beating my head against the wall right now. Lol! I am trying to do a table scan but SELECT statements are different in Clipper. To be quite honest, i don't know what I'm doing. New topic??
How to SCAN table
Enviado: 25 Jan 2013 17:32
por Pablo César
Yes MArge, you can continue in this topic taking in mind that your difficulties are scanning data in the table.
I have changed your topic´s title just to give more sense to all topic.
My appologies for any disturbing.
How to SCAN substrings in a dbf - Summer 87
Enviado: 25 Jan 2013 17:51
por Pablo César
Marge, I believe that you will need to make a search menu for user takes different options. When you need to search in only one field or in both. Then you will know the right command to use for SORT it.
How to SCAN substrings in a dbf - Summer 87
Enviado: 25 Jan 2013 17:56
por marge0512
Sure, no problem!
Well, like I said, I'm not sure what I'm doing so don't laugh.......I've been playing with code and trying and changing to no avail. I have this now but I get: Error DBFNTX/1020 Data type error: Compny_nam.
INDEX ON COMPNY_NAM TO tmpTable FOR (REC2FIND $ UPPER(COMPNY_NAM) .or. REC2FIND $ UPPER(CASE_LNAME))
SELECT CASES <-------original table name.
Go top
Do while !eof()
Cascomp = (REC2FIND $ UPPER(cases->COMPNY_NAM)) <-------Here is where i get the error.
Caslnam = (REC2FIND $ UPPER(cases->CASE_LNAME))
USE tmpTable SHARED
If tmptable->(dbappend())
Tmptable->compny_nam = cascomp
tmptable->case_lname = caslnam
Endif
Select CASES
Skip
enddo
When debugging, "Cascomp" has a value of .F. and "Caslnam" has a value of .T. which is not my intention. I wanted a field value stored in these variables. Not sure what I'm doing wrong but I think i have a slight mess on my hands!
How to SCAN substrings in a dbf - Summer 87
Enviado: 25 Jan 2013 18:39
por alxsts
Hi!
The dollar operator returns a logical value (.T. or .F.) , indicating whether or not the search argument was found in the target string.
Código: Selecionar todos
PRIVATE cString
DECLARE a Struct[2]
aStruct[1] = { "COMPNY_NAM", "C", 40, 0 }
aStruct[2] = { "CASE_LNAME", "C", 40, 0 }
DbCreate( "tmpTable", aStruct)
USE tmpTable EXCLUSIVE
&& tmpTable is the current selected work area
Do WHILE cases->( ! Eof() )
cString = ""
&& search LNAME first cause if REC2FIND exists in both fields, it takes precedence
IF (REC2FIND $ UPPER(cases->CASE_LNAME))
cString = cases->CASE_LNAME
ELSEIF (REC2FIND $ UPPER(cases->COMPNY_NAM))
cString = cases->COMPNY_NAM
ENDIF
IF Len( cString) > 0
&& something was found. Write it...
Itmptable->(dbappend())
IF .Not. NetErr()
tmpTable->COMPNY_NAM = cases->COMPNY_NAM
tmpTable->CASE_LNAME = cString
ELSE
&& Error. Display some message and quit
QUIT
ENDIF
ENDIF
cases->( dBsKIP() )
ENDDO
&& tmpTable is still the current selected work area
INDEX ON COMPNY_NAM TO tmpTable
After this point, adjust the DbEdit() call and let it run.
After DbEdit() ran, check the exit state: if ESC pressed, move the cases table record pointer to the one saved at the beginning. Otherwise, you'll have tmpTable positioned on the selected record. Move tmpTable->COMPNY_NAM to the REC2FIND variable. Close tmpTable, delete it and the index file. Now let the flow proceed as already coded: use the REC2FIND variable to SEEK the cases table. If found, terminate else move cases table pointer to saved recno and exit... and so on. I haven't compiled this code. Pease test it.
Edited: Note that DbEdit() will show the tmpTable->CASE_LNAME field, where we stored the matches found. The other field (tmpTable->COMPNY_NAM) contains the key you'll use to SEEK the cases table when user selects something in DbEdit().