Seek function isn't working for DBF with CDX index in X# - VO Dialect

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
ArunBerlin
Posts: 33
Joined: Tue Oct 27, 2020 1:19 pm
Location: India

Seek function isn't working for DBF with CDX index in X# - VO Dialect

Post by ArunBerlin »

The below seek is always returning Not Found.
I've manually verified that the sParameter key is present in DBF using a DBF Viewer. Also confirmed that no extra space is present.
Index File used : CDX

Code: Select all

IF INIFILE:Seek(sParameter)
  //Found
ELSE
 //Not Found
ENDIF
Is there any way to solve it ?
Does CDX needs to be reindexed to run in X# and Windows 10 environment.
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Seek function isn't working for DBF with CDX index in X# - VO Dialect

Post by Chris »

Hi,

Please post the dbf and cdx files (or you can send them directly to me at chris at xsharp eu if they contain sensitive data), together with the exact string you are searching for, so we can have a look and diagnose the problem.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
ArunBerlin
Posts: 33
Joined: Tue Oct 27, 2020 1:19 pm
Location: India

Re: Seek function isn't working for DBF with CDX index in X# - VO Dialect

Post by ArunBerlin »

Hi Chris,

I've attached the DBF file and its cdx file with the reply.

Seek : CONNECT STRING
Please have a look at it.
Attachments
DBF_Index.zip
(1.29 KiB) Downloaded 102 times
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Seek function isn't working for DBF with CDX index in X# - VO Dialect

Post by Chris »

Hi,

Thanks for the files, I see two problems with them:

- The index file seems to be corrupted, when I open it also with VO, I see no records at all. After I rebuild the index, then it works fine. How did you create the index, was it with VO?

- The key expression for the index is USERID+PARAM_CODE, and the field USERIED field contains only the values "BASE", "RAVI", "SLAIRD" and "WELLSK". It's only the PARAM_CODE field that does contain a record with the string you are seeking for ("CONNECT STRING"), so of course simply seeking for this string (without taking into account the first part of the expression) will not give a result, neither in X# or in VO.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
ArunBerlin
Posts: 33
Joined: Tue Oct 27, 2020 1:19 pm
Location: India

Re: Seek function isn't working for DBF with CDX index in X# - VO Dialect

Post by ArunBerlin »

Hi,

Thank you Chris, for giving the insight. The .cdx file was picked from an older system having VO environment.

Could you please provide a brief description on how to rebuild index in Windows 10 X# ?

Yes, the seek() also had a logical error.
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Seek function isn't working for DBF with CDX index in X# - VO Dialect

Post by Chris »

Hi Arun,

The easiest way is to just delete the .cdx file and recreate it with this small code:

FUNCTION Start() AS INT STRICT
LOCAL cDbf AS STRING
cDbf := "C:\.....\INIFILE"
DbUseArea(,"DBFCDX",cDbf)
? DbCreateIndex(cDbf, "USERID+PARAM_CODE")
DbCloseArea()
RETURN 0
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Post Reply