Page 2 of 3
Re: Please help with syntax
Posted: Sun Mar 08, 2015 5:19 pm
by robbie73
I have just checked with a different set of data and the program seems to run ok up to a point... That is if one of the tables listed in the supporting .dbf does not exist (How can I check that db exists and exit gracefully if it doesn't? Or trap the error and skip overe it?)
OR if there is some other kind of problem with the data? I also attached .D file that causes the problem with the ALLTRIM Error.
Re: Please help with syntax
Posted: Sun Mar 08, 2015 5:22 pm
by robbie73
Thnak you esgici and Pablo very much for your advice and help
Re: Please help with syntax
Posted: Sun Mar 08, 2015 8:31 pm
by esgici
robbie73 wrote:
I have just checked with a different set of data and the program seems to run ok up to a point... That is if one of the tables listed in the supporting .dbf does not exist (How can I check that db exists and exit gracefully if it doesn't? Or trap the error and skip overe it?)
OR if there is some other kind of problem with the data? I also attached .D file that causes the problem with the ALLTRIM Error.
Hi Robby
This check program :
Code: Select all
PROC MAIN
USE LBORROW
MsgDebug( "SurName : ", LEN( ALLTRIM( SURNAME ) ),;
EMPTY( SURNAME ) ,;
"GivenName : ", LEN( ALLTRIM( GIVENNAME ) ),;
EMPTY( GIVENNAME ) )
RETU
said :
- EmtyCheck.PNG (1.15 KiB) Viewed 4997 times
This means no problem in your data.
My environment is : HMG 3.4.0, 32 Bit; IDE: Unicode.
May be you are using IDE-ANSII ?
Please check and if inform me if problem persist.
Happy HMG'ing
Re: Please help with syntax
Posted: Mon Mar 09, 2015 6:58 am
by robbie73
Thank you Escigi
MY IDE shows unicode? I think? where to check?
changelog says:
-HMG 3.4.0 2015/01/18
- Updated to latest Harbour Nightly Build (2015-01-14)
- Updated to latest MingW Compiler
- New HMG IDE version 1.0.8
Re: Please help with syntax
Posted: Mon Mar 09, 2015 7:15 am
by robbie73
ahh.. i think i might have found the problem. The .prg uses other .dbf files as a lookup. For the person first and surname it looks like this in the lookup table:
ColumnA(DB), ColumnB(Field), ColumnC(Size)
PERSON_DATABASE.DBF BARCODE 1 <-- this is good and the rest of the reference table looks like this.
PERSON_DATABASE.DBF SURNAME+GIVENNAME 1 <-- Is where the problem is i think
Surname and given name are two separate fields in the data, that have been joined in the reference table with the + symbol. This is because duplicate checking requires this. otherwise it would delete all the people with the same first name or surname.
Advice how to handle this please? or maybe remove from the duplicate check on NAME?
UPDATE:
No. i used a different reference table and avoided the SURNAME + GIVEN NAME and it made no difference. same error.
Re: Please help with syntax
Posted: Mon Mar 09, 2015 9:33 am
by serge_girard
Robbie,
May I suggest to examine to valueof vfield before using the Alltrim function; vfield is probably empty.
Serge
Re: Please help with syntax
Posted: Mon Mar 09, 2015 11:33 am
by esgici
Hi Robby
Please try this ( two lines added and marked with "<--" ) :
Code: Select all
procedure blanks()
select 1; use blank.dbf
message(3,opy,mess,"Blank and Invalid Codes")
do while !eof()
vfile=file; vfield=field; vsize=size
message(4,filey,mess,"Deleting "+(vfile))
select 2; use &vfile; setbar()
hold=4
do while !eof()
progress(recno(),lastrec())
IF VALTYPE( &vfield ) = "C" // <--
if len(alltrim(&vfield))<vsize
//if len(alltrim(&vfield)) <-- how to use alternative to ALL TRIM?
errortofile("Blank/Invalid",vfile,recno())
if upper(delrep)="D"
delete
endif
endif
ENDIF // <--
skip
enddo
select 1
skip
enddo
close 1; close 2
Regards
Please help with syntax
Posted: Mon Mar 09, 2015 11:43 am
by Pablo César
serge_girard wrote:May I suggest to examine to valueof vfield before using the Alltrim function; vfield is probably empty.
esgici wrote:IF VALTYPE( &vfield ) = "C"
Pablo César wrote:I believe this error, it is because there is nothing to make alltrim. Probably data type it is not data character type (Nil type, an array, date type or numeric type). Then it's not gonna works.
You can previously test it with Alert(
ValType(cVar) ).
..//..
Always be carful with error messages. It's saying:
BASE/2022 Argument error: ALLTRIM
So, please
read this
As I said before...
Re: Please help with syntax
Posted: Tue Mar 10, 2015 5:42 am
by robbie73
Thank you All. I am going to work my way through your suggestions..
Bear in mind I am new to clipper! so it might take some time.
Thank you all again.
I will post back when i have solved it.
Re: Please help with syntax
Posted: Wed Mar 11, 2015 2:28 am
by esgici
robbie73 wrote:I am going to work my way through your suggestions..
Bear in mind I am new to clipper! so it might take some time.
I will post back when i have solved it.
Hi Robbie
Please don't worry about being new; all of us was new at beginning
I'm sure that you will like Clipper programming and Harbour + HMG : Clipper for Windows
More, here you are between friends; please don't hesitate to ask anything; hopefully you will find always helpers.
I hope that this short
sample will be useful for you.
Happy HMG'ing