Welcome! Log In Create A New Profile

Advanced

WD18 INDEX

Posted by Marc De Swert 
Marc De Swert
WD18 INDEX
January 25, 2024 09:37AM
Hello,

Does anyone know how I can automate the following?
Windev18
The problem: One of my users had an error on an Hfile with index.
It is suggested to reindex the file.

I opened the file and in the tools menu there is an option to reindex, so no problem.
But I would like the user to be able to do this themselves via a separate screen in the program.
I would only show the file names so that he can select them and then reindex them via a button.
Without having to open the file himself and doing anything wrong with the file directly.

Is there some instruction I can put in the button to do this?

Thanks in advance if anyone has an idea.

Marc.
Re: WD18 INDEX
January 25, 2024 01:09PM
Hi Marc,

this can be done with hindex: code example from my Windev10 APP


1. find out the Filename e.g with flistfile

2. some checks:

PROCEDURE reorgfiles(Path,FileName,Change,Pointer)
res is int
file1 is string
zus is string
res = Position(FileName,".")
file1 = Left(FileName,res-1)
zus = Middle(FileName,res+1,3)
IF zus = "FIC" OR zus = "fic" OR zus = "Fic"
cnt++
res = HCheckIndex(file1)
// manage the result
//SWITCH res

// CASE 0
// Info("Valid index")
// CASE 1
// Info("Corrupted index. Reindex the file")
// CASE 2
// Info("Hyper File error"+HError()+"during the test")
// CASE 3
// Info("Function not supported on this type of file")
//END

IF NOT reindfiles(file1) THEN Info(file1 + " : Reindex fehlerhaft")

END




PROCEDURE reindfiles(FileName)
//HInfoGene(FileName) // for h.Dir
//if hislocked() then result FALSE
Message(FileName)
HClose(FileName)

IF HErrorLock() THEN RESULT False


IF HIndex(FileName,hNdxCompact,menu200) <> 1 THEN RESULT False


// ok
RESULT True


regards, Heinz
Marc De Swert
WD18 INDEX
January 25, 2024 01:28PM
thxs

will try this!

Marc
Marc De Swert
WD18 INDEX
January 25, 2024 01:37PM
Hi Heinz,

it's working perfect!

Marc
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: