A question about function FW_Cdxcreate()

A question about function FW_Cdxcreate()

Postby ukoenig » Mon Feb 26, 2018 7:16 pm

Hello,

I wanted to create individual indexes for 7 files
before I used < FW_Cdxcreate() > :D
everything works fine without problems
next I started to define extra indexes :roll:
The solution returns < corrupt index >after restart
I saw that it is possible to define parameter in FW_Cdxcreate() :?:
Never before I had any problems creating indexfiles.

strange :(
viewtopic.php?f=3&t=9931&p=48111&hilit=cdx+error+1012#p48111

Image

With my external DBF-viewer I can open the file without problems
and the indexfiles are created.
NO problems using FW_Cdxcreate() :roll:

Image

Code: Select all  Expand view  RUN

        DBSELECTAREA(cFileName) // filenames from sample1 to 7
        FW_CdxCreate()

        ORDCREATE( ,"TOPICNO", "DESCEND( STR( TOPICNO ) )", ;
                {|| DESCEND(STR( TOPICNO ) ) } , .F. )  
        ORDCREATE( ,"FORUM","STR( FORUM )", ;
                {|| STR( FORUM ) } , .F. )  
        ORDCREATE( ,"DELETE","STR( T_DELETE )", ;
                {|| STR( T_DELETE ) } , .F. )  
        ORDCREATE( ,"DATE","DTOS( DATE )", ;
                {|| DTOS( DATE ) } , .F. )  
        ORDCREATE( ,"AUTHOR","AUTHOR + INFO1 + INFO2", ;
                {|| AUTHOR  + INFO1 + INFO2 } , .F. )
        ORDCREATE( ,"LIKE", "STR( LIKE ) + AUTHOR + INFO1 + INFO2 ) ", ;
                {|| STR( LIKE ) + AUTHOR + INFO1 + INFO2 } , .F. )     
        ORDCREATE( ,"INFO1","INFO1", ;
                {|| INFO1 } , .F. )        
        ORDCREATE( ,"INFO2","INFO2", ;
                {|| INFO2 } , .F. )        

 


There is nothing special opening a dbf with my NETTOOLS

The errorline
-> 37 USE &cFileName ALIAS &cAlias NEW SHARED

Code: Select all  Expand view  RUN

FUNCTION NET_USE ( cFileName, cAlias, nTrials, nTime, lNet )
LOCAL lReturn  := .T.
LOCAL lOpen    := .F.

nTrcount   := nTrials
YesNo := .F.

// SHARED   all Users
// EXCLUSIVE  1 User

IF FILE( cFileName )
    nTrials := nTrcount
    DO WHILE !lOpen
        DO WHILE .T.
            IF !lNet
                USE &cFileName ALIAS &cAlias NEW EXCLUSIVE
            ELSE
                USE &cFileName ALIAS &cAlias NEW SHARED
            ENDIF
,,,
,,,
 


Any idea :?:
Last edited by ukoenig on Tue Feb 27, 2018 9:35 am, edited 3 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A question about function FW_Cdxcreate()

Postby karinha » Mon Feb 26, 2018 8:00 pm

Maybe:

Code: Select all  Expand view  RUN

   FW_CdxCreate()

   CLOSE DATABASE

   USE SAMPLES EXCLUSIVE VIA "DBFCDX"  // or SHARED

 


Regards
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: A question about function FW_Cdxcreate()

Postby ukoenig » Mon Feb 26, 2018 8:11 pm

Indexing 7 DBF's

FW_CdxCreate() // WORKS !!!

I tested index by index ALL numerics ( red ) don*t work !

//ORDCREATE( ,"TOPICNO", "DESCEND( STR( TOPICNO ) )", ;
// {|| DESCEND(STR( TOPICNO ) ) } , .F. )
//ORDCREATE( ,"FORUM","STR( FORUM )", ;
// {|| STR( FORUM ) } , .F. )
//ORDCREATE( ,"DELETE","STR( T_DELETE )", ;
// {|| STR( T_DELETE ) } , .F. )

ORDCREATE( ,"DATE","DTOS( DATE )", ;
{|| DTOS( DATE ) } , .F. )
ORDCREATE( ,"AUTHOR","AUTHOR + INFO1 + INFO2", ;
{|| AUTHOR + INFO1 + INFO2 } , .F. )

//ORDCREATE( ,"LIKE", "STR( LIKE ) + AUTHOR + INFO1 + INFO2 ) ", ;
// {|| STR( LIKE ) + AUTHOR + INFO1 + INFO2 } , .F. )

ORDCREATE( ,"INFO1","INFO1", ;
{|| INFO1 } , .F. )
ORDCREATE( ,"INFO2","INFO2", ;
{|| INFO2 } , .F. )


DBCREATE( c_path + cFilename + ".DBF", { ;
{ "TOPICNO", 'N', 6, 0 }, ; :cry:
{ "LINK", 'C', 70, 0 }, ;
{ "TOPIC", 'C', 65, 0 }, ;
{ "AUTHOR", 'C', 40, 0 }, ; :D
{ "DATE", 'D', 8, 0 }, ; :D
{ "LIKE", 'N', 1, 0 }, ; :cry:
{ "T_DELETE", 'N', 1, 0 }, ; :cry:
{ "INFO1", 'C', 15, 0 }, ; :D
{ "INFO2", 'C', 15, 0 }, ; :D
{ "FORUM", 'N', 1, 0 }, ; :cry:
{ "CODE", 'M', 10, 0 } }, "DBFCDX", .T., "DB" )


creating indexes for files < Samples1 - 7 >

Code: Select all  Expand view  RUN


I := 1
FOR I := 1 TO 7
    X := LTRIM(STR(I))
    cFileName   := "SAMPLES" + X
    IF !File( c_path + cFilename + ".CDX" )

        DBSELECTAREA(cFileName)
        //FW_CdxCreate() //  WORKS !!!
 
        ORDCREATE( ,"TOPICNO", "DESCEND( STR( TOPICNO ) )", ;
                {|| DESCEND(STR( TOPICNO ) ) } , .F. )  
        ORDCREATE( ,"FORUM","STR( FORUM )", ;
                {|| STR( FORUM ) } , .F. )  
        ORDCREATE( ,"DELETE","STR( T_DELETE )", ;
                {|| STR( T_DELETE ) } , .F. )  
        ORDCREATE( ,"DATE","DTOS( DATE )", ;
                {|| DTOS( DATE ) } , .F. )  
        ORDCREATE( ,"AUTHOR","AUTHOR + INFO1 + INFO2", ;
                {|| AUTHOR  + INFO1 + INFO2 } , .F. )
        ORDCREATE( ,"LIKE", "STR( LIKE ) + AUTHOR + INFO1 + INFO2 ) ", ;
                {|| STR( LIKE ) + AUTHOR + INFO1 + INFO2 } , .F. )     
        ORDCREATE( ,"INFO1","INFO1", ;
                {|| INFO1 } , .F. )        
        ORDCREATE( ,"INFO2","INFO2", ;
                {|| INFO2 } , .F. )        

    ENDIF
NEXT
 


I got it working deleting all STR( for only numeric fields
but what to do with < STR( LIKE ) + AUTHOR + INFO1 + INFO2 > numeric + text + text + text :?:

regards
Uwe :(
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A question about function FW_Cdxcreate()

Postby nageswaragunupudi » Tue Feb 27, 2018 2:51 am

FW_CdxCreate( [caTagList], [lMemory] ) --> lSuccess

Works only for DBFCDX. It is desirable to delete the existing cdx and open the DBF in exclusive mode before calling this function.

Param.2: [lMemory] Defaults to .F.. If .t., creates temporary index in memory with bag name "TMP"

Param.1: [caTagList]
DEFAULT: All fields excepting memo fields. All character fields are indexed with UPPER(<fldname>). Other fields are indexed with their own data types, i.e., not converted as character type. In addition, a tag with name "DELETED" is created with expression "DELETED()". This tag is meant for optimization of navigation by setting filter to "!DELETED()".

caTagList can be specified as a comma-delimited list of field names. "DELETED" can also be specified as a field name.

caTaglist can also be specified as an array of fieldnames/expressions. Each if the element can be a field name or an array of {expression, tagname}.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: A question about function FW_Cdxcreate()

Postby Marc Venken » Tue Feb 27, 2018 8:02 am

Mr. Rao,

In many posts, i have seen the advice of creating ALL the indexes with a deleted() into it.

// Also do all your indexes "for ! deleted()"
// And you MUST USE the TAG clause!

use customer
index on chgno tag "custid" to customer for ! deleted()
index on descrip tag "company" to customer for ! deleted()
index on phone tag "phone" to customer for ! deleted()
...

You use a other approach with the set filter ?

In my case, in Xbrowse 1 have many indexes, and many deleted records. At a given moment I would like to show also the deleted one.
So best I set a Checkbox for toggle the Xbrowse deleted with a filter condition then ?
If so, I can search for samples here.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1438
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: A question about function FW_Cdxcreate()

Postby ukoenig » Tue Feb 27, 2018 8:33 am

Mr. Rao,

thank You very much for the info

Code: Select all  Expand view  RUN
Other fields are indexed with their own data types, i.e., not converted
as character type.


that seems to be the reason that it works without problems.
As soon a create a index with STR( field ) // numeric
I'm getting problems. But I have to define it with a index-mix of C and N.
I didn't test < cValToChar > lets see what happens.

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A question about function FW_Cdxcreate()

Postby nageswaragunupudi » Tue Feb 27, 2018 8:38 am

As soon a create a index with STR( field ) // numeric
I'm getting problems.

There is nothing wrong with it.
What kind of problems are you getting?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: A question about function FW_Cdxcreate()

Postby ukoenig » Tue Feb 27, 2018 9:39 am

Mr. Rao,

the problem is a index numeric + text + text
I changed STR(nVal) to cValtoChar(nVal) and that seems to work :shock:
But now my external dbf-editor shows a errormessage because he doesn't know -> cValtoChar

I want to sort the two defined filters inside LIKE and it looks OK now

Image

seek LIKE 25, 50, 75 or 100 %

Image

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A question about function FW_Cdxcreate()

Postby nageswaragunupudi » Tue Feb 27, 2018 3:24 pm

STR(..) should not give any error, if LIKE is a numeric field.
We need to use common functions only in index expressions.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Marc Venken and 29 guests