Please help with syntax
Moderator: Rathinagiri
Re: Please help with syntax
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.
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.
Last edited by robbie73 on Mon Mar 09, 2015 6:47 am, edited 2 times in total.
Re: Please help with syntax
Thnak you esgici and Pablo very much for your advice and help
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Please help with syntax
Hi Robbyrobbie73 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.
This check program :
Code: Select all
PROC MAIN
USE LBORROW
MsgDebug( "SurName : ", LEN( ALLTRIM( SURNAME ) ),;
EMPTY( SURNAME ) ,;
"GivenName : ", LEN( ALLTRIM( GIVENNAME ) ),;
EMPTY( GIVENNAME ) )
RETU
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
Last edited by esgici on Tue Mar 10, 2015 10:13 pm, edited 2 times in total.
Viva INTERNATIONAL HMG
Re: Please help with syntax
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
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
- Attachments
-
- hmg forum Unicode.PNG (14.02 KiB) Viewed 4975 times
Re: Please help with syntax
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.
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.
- serge_girard
- Posts: 3178
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Please help with syntax
Robbie,
May I suggest to examine to valueof vfield before using the Alltrim function; vfield is probably empty.
Serge
May I suggest to examine to valueof vfield before using the Alltrim function; vfield is probably empty.
Serge
There's nothing you can do that can't be done...
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Please help with syntax
Hi Robby
Please try this ( two lines added and marked with "<--" ) :
Regards
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
Viva INTERNATIONAL HMG
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Please help with syntax
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"
As I said before...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
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: Please help with syntax
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.
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.
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Please help with syntax
Hi Robbierobbie73 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.
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
Viva INTERNATIONAL HMG