Please help with syntax

Moderator: Rathinagiri

robbie73
Posts: 11
Joined: Sat Jan 05, 2013 6:59 pm

Re: Please help with syntax

Post 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.
Last edited by robbie73 on Mon Mar 09, 2015 6:47 am, edited 2 times in total.
robbie73
Posts: 11
Joined: Sat Jan 05, 2013 6:59 pm

Re: Please help with syntax

Post by robbie73 »

Thnak you esgici and Pablo very much for your advice and help :D
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Please help with syntax

Post 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
EmtyCheck.PNG (1.15 KiB) Viewed 4959 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 :D
Last edited by esgici on Tue Mar 10, 2015 10:13 pm, edited 2 times in total.
Viva INTERNATIONAL HMG :D
robbie73
Posts: 11
Joined: Sat Jan 05, 2013 6:59 pm

Re: Please help with syntax

Post 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
Attachments
hmg forum Unicode.PNG
hmg forum Unicode.PNG (14.02 KiB) Viewed 4936 times
robbie73
Posts: 11
Joined: Sat Jan 05, 2013 6:59 pm

Re: Please help with syntax

Post 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.
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Please help with syntax

Post by serge_girard »

Robbie,

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...
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Please help with syntax

Post 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
Viva INTERNATIONAL HMG :D
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Please help with syntax

Post 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 :idea:
As I said before... 8-)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
robbie73
Posts: 11
Joined: Sat Jan 05, 2013 6:59 pm

Re: Please help with syntax

Post 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.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Please help with syntax

Post 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 :arrow:

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 :D
Viva INTERNATIONAL HMG :D
Post Reply