Alaska Software Inc. - Foxpro and Xbase
Username: Password:
AuthorTopic: Foxpro and Xbase
Alain RFoxpro and Xbase
on Wed, 22 Apr 2015 17:08:53 +0200
Hello

    I have a insolving problem with FoxProx et Xbase with index file

I'm working in Clipper, dbase and Xbase.

At office, we use a program from Headquater and It's writing in FoxPro !

With a program write in Xbase, I would like use DBF FOXPRO without
use the index files created by FoxPro.

It's works fine since 2 years but we have a new program from main office.

Now I have a problem of indexing.

When I create a new index ( with DbeSetDefault( "FOXCDX" ) )
i have a problem with a field named clenunik_1  ( it's structure is 
character)

my coding :

   DbeSetDefault( "FOXCDX" )
   icibleB   := w_rep_tempo + "clefunik.cdx"
   delete FILE (icibleB)
   do init_p
      OrdCreate(iCibleB,,"upper(clenunik_1)",{||prog_p(upper(clenunik_1))}) 
( VERSION 1)
   do end_p


      OrdCreate(iCibleB,,"clenunik_1",{||prog_p(clenunik_1)})    ( VERSION 
2)


The indexation works because the windows progression show the status (oProgr 
:= ProgressBar():new(oFCrt,,{950,030},{15,650},,.f.))

but when te program must close the index files, it crashes

When I use version 1 with UPPER :

------------------------------------------------------------------------------
Log Erreur de "Gestion CE.EXE" Date: 22/04/2015 16:58:23

Xbase++ version     : Xbase++ (R) Version 1.90.331
SystSme d'op,raton  : Windows XP 05.01 Build 02600 Service Pack 3
------------------------------------------------------------------------------
oError:args         :
          -> VALTYPE: U VALUE: NIL
oError:canDefault   : N
oError:canRetry     : N
oError:canSubstitute: Y
oError:cargo        : NIL
oError:description  : Parameter has a wrong data type
oError:filename     :
oError:genCode      :          2
oError:operation    : upper
oError:osCode       :          0
oError:severity     :          2
oError:subCode      :       1025
oError:subSystem    : BASE
oError:thread       :          1
oError:tries        :          0
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Appel par (B)FACTURATION(0)
Appel par FACTURATION(265)
Appel par (B)MAIN(453)
Appel par MAIN(498)


When a use version 2 without UPPER :


------------------------------------------------------------------------------
Log Erreur de "Gestion CE.EXE" Date: 22/04/2015 17:01:27

Xbase++ version     : Xbase++ (R) Version 1.90.331
SystSme d'op,raton  : Windows XP 05.01 Build 02600 Service Pack 3
------------------------------------------------------------------------------
oError:args         :
          -> VALTYPE: C VALUE: F:\bdce\data\clefunik.cdx
          -> VALTYPE: U VALUE: NIL
          -> VALTYPE: C VALUE: clenunik_1
          -> VALTYPE: B VALUE: {||prog_p(clenunik_1)}
          -> VALTYPE: L VALUE: Y
          -> VALTYPE: L VALUE: Y
oError:canDefault   : Y
oError:canRetry     : Y
oError:canSubstitute: N
oError:cargo        : NIL
oError:description  :
oError:filename     :
oError:genCode      :       8999
oError:operation    : OrdCreate
oError:osCode       :          0
oError:severity     :          2
oError:subCode      :          0
oError:subSystem    : BASE
oError:thread       :          1
oError:tries        :          1
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Appel par FACTURATION(266)
Appel par (B)MAIN(453)
Appel par MAIN(498)


Thanks for your ideas and sorry for my bad english

alain

on
Alain RRe: Foxpro and Xbase
on Fri, 24 Apr 2015 10:17:40 +0200
Bonjour Andreas

Thanks to your answer.

I join a pdf with the structure of the FOX DBF
The fields to indexed is "Clenunik_1"
It's a Character Fieldtype BUT now, a modification on the structure appears
with "Field NULL"  = True !!!!!!!
Before it was False
Evidently,I can't modified the Structure !
It's possible to use this DBF wtih Xbase ?

Thanks a lot

I use this dbesys :
//////////////////////////////////////////////////////////////////////

  DBESYS.PRG

  Copyright:
      Alaska Software, (c) 1998-2006. All rights reserved.

  Contents:
      Xbase++ DatabaseEngine startup/preloader

  Syntax:
      DbeSys() is called automatically at program start before the
      function MAIN.

//////////////////////////////////////////////////////////////////////


#define MSG_DBE_NOT_LOADED   " database engine not loaded"
#define MSG_DBE_NOT_CREATED  " database engine could not be created"

*******************************************************************************
* DbeSys() is always executed at program startup
*******************************************************************************
PROCEDURE dbeSys()
/*
 *   The lHidden parameter is set to .T. for all database engines
 *   which will be combined to a new abstract database engine.
 */
LOCAL aDbes := { { "DBFDBE", .T.},;
                 { "NTXDBE", .T.},;
                 { "DELDBE", .F.},;
                 { "SDFDBE", .F.} }
LOCAL aBuild :={ { "DBFNTX", 1, 2 } }
LOCAL i

  /*
   *   Set the sorting order and the date format
   */
  SET COLLATION TO FRENCH
  SET DATE TO FRENCH
  SET CENTURY ON

  /*
   *   load all database engines
   */
  FOR i:= 1 TO len(aDbes)
      IF ! DbeLoad( aDbes[i][1], aDbes[i][2])
         Alert( aDbes[i][1] + MSG_DBE_NOT_LOADED , {"OK"} )
      ENDIF
  NEXT i

  /*
   *   create database engines
   */
  FOR i:= 1 TO len(aBuild)
      IF ! DbeBuild( aBuild[i][1], aDbes[aBuild[i][2]][1], 
aDbes[aBuild[i][3]][1])
         Alert( aBuild[i][1] + MSG_DBE_NOT_CREATED , {"OK"} )
      ENDIF
  NEXT i

RETURN


 EOF


Struct Fox.pdf
Alain RRe: Foxpro and Xbase
on Sat, 25 Apr 2015 13:09:00 +0200
Hello

I modified my Subprogram dbesys.prg as in the attached file.
Now, The indexations works correctly excepted for "clenunik_1" declared in 
foxpro as field character with
Activated NULL!!

At the moment, I stopped  this indexation but I wait for your ideas

Thanks a lot

Alain


"Alain R" <excalibur-66@orange.fr> a écrit dans le message de groupe de 
discussion : 6ca3eb0d$6bedccaa$4522e@news.alaska-software.com...
> Bonjour Andreas
>
> Thanks to your answer.
>
> I join a pdf with the structure of the FOX DBF
> The fields to indexed is "Clenunik_1"
> It's a Character Fieldtype BUT now, a modification on the structure 
> appears
> with "Field NULL"  = True !!!!!!!
> Before it was False
> Evidently,I can't modified the Structure !
> It's possible to use this DBF wtih Xbase ?
>
> Thanks a lot
>
> I use this dbesys :
> //////////////////////////////////////////////////////////////////////
> 
>   DBESYS.PRG
> 
>   Copyright:
>       Alaska Software, (c) 1998-2006. All rights reserved.
> 
>   Contents:
>       Xbase++ DatabaseEngine startup/preloader
> 
>   Syntax:
>       DbeSys() is called automatically at program start before the
>       function MAIN.
> 
> //////////////////////////////////////////////////////////////////////
>
>
> #define MSG_DBE_NOT_LOADED   " database engine not loaded"
> #define MSG_DBE_NOT_CREATED  " database engine could not be created"
>
> *******************************************************************************
> * DbeSys() is always executed at program startup
> *******************************************************************************
> PROCEDURE dbeSys()
> /*
> *   The lHidden parameter is set to .T. for all database engines
> *   which will be combined to a new abstract database engine.
> */
> LOCAL aDbes := { { "DBFDBE", .T.},;
>                 { "NTXDBE", .T.},;
>                 { "DELDBE", .F.},;
>                 { "SDFDBE", .F.} }
> LOCAL aBuild :={ { "DBFNTX", 1, 2 } }
> LOCAL i
>
>  /*
>   *   Set the sorting order and the date format
>   */
>  SET COLLATION TO FRENCH
>  SET DATE TO FRENCH
>  SET CENTURY ON
>
>  /*
>   *   load all database engines
>   */
>  FOR i:= 1 TO len(aDbes)
>      IF ! DbeLoad( aDbes[i][1], aDbes[i][2])
>         Alert( aDbes[i][1] + MSG_DBE_NOT_LOADED , {"OK"} )
>      ENDIF
>  NEXT i
>
>  /*
>   *   create database engines
>   */
>  FOR i:= 1 TO len(aBuild)
>      IF ! DbeBuild( aBuild[i][1], aDbes[aBuild[i][2]][1],
> aDbes[aBuild[i][3]][1])
>         Alert( aBuild[i][1] + MSG_DBE_NOT_CREATED , {"OK"} )
>      ENDIF
>  NEXT i
>
> RETURN
>
> 
>  EOF
>
>


DBESYSJC.pdf
Andreas Gehrs-Pahl
Re: Foxpro and Xbase
on Sat, 25 Apr 2015 13:12:32 -0400
Alain,

Posting PDF files instead of text/program files is a bad idea, as it 
unnecessarily increases the length of the post, and makes it much more 
complicated to extract any of the information from those files.

To answer your main question -- as Peter Alderliesten already did in the GUI 
newsgroup -- just add the following command to your code, before you open 
the database: "Set NullValue Off". You can place that line into the DbeSys()
procedure if you want, as you probably want this to be the default behavior 
for all your databases.

I have attached a small demo program, based on your two PDF files that shows 
that this will work. Just remark out the "NullValue" line in the DbeSys() 
procedure, and you will get the same error(s) as you reported.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas.GP@Charter.net
web:   http://www.Aerospace-History.net

Fox_Null.zip
Alain RRe: Foxpro and Xbase
on Thu, 30 Apr 2015 11:43:49 +0200
Hi Thomas

    Thanks to your answer

I have simply add 	"Set NullValue Off" in my dbesys.prg
and now that's work perfectly

thank you very much

Bye

Alain




"Andreas Gehrs-Pahl" a écrit dans le message de groupe de discussion : 
1ja37ra6gimu7$.1rh004hujez1q$.dlg@40tude.net...
> Alain,
>
> Posting PDF files instead of text/program files is a bad idea, as it
> unnecessarily increases the length of the post, and makes it much more
> complicated to extract any of the information from those files.
>
> To answer your main question -- as Peter Alderliesten already did in the 
> GUI
> newsgroup -- just add the following command to your code, before you open
> the database: "Set NullValue Off". You can place that line into the 
> DbeSys()
> procedure if you want, as you probably want this to be the default 
> behavior
> for all your databases.
>
> I have attached a small demo program, based on your two PDF files that 
> shows
> that this will work. Just remark out the "NullValue" line in the DbeSys()
> procedure, and you will get the same error(s) as you reported.
>
> Hope that helps,
>
> Andreas
> -- 
> Andreas Gehrs-Pahl
> Absolute Software, LLC
>
> phone: (989) 723-9927
> email: Andreas.GP@Charter.net
> web:   http://www.Aerospace-History.net