Open Error DBF with dash

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
serge_girard
Posts: 2361
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 607 times
Been thanked: 124 times
Contact:

Open Error DBF with dash

Post by serge_girard » Sun Nov 03, 2019 10:31 am

Does anybody know how to avoid this error:
It appears when opening a DBF with a dash char in it's name. Open the DBF file with a DBF viewer is no problem

Code: Select all

Subsystem 	DBFNTX
Subcode	1001
CanDefault	True
CanRetry	True
Description	Open error
Operation	
Filename	03012014-F0001.dbf
Oscode	2
Gencode	21
Severity	2
Thanks, Serge
Attachments
dbfvw.png
dbfvw.png (15.6 KiB) Viewed 149 times

edk
Posts: 499
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 136 times
Been thanked: 406 times

Post by edk » Sun Nov 03, 2019 3:21 pm

Hi Serge.

The problem is not the file name but Alias, which, if not declared, will take the file name. From what I remember, Alias cannot begin with a digit, it cannot contain a dash, comma, semicolon, spaces, period, etc.

Code: Select all

cDBF:='03012014-F0001.dbf'
Select 1
use &(cDbf) alias &(IF(IsDigit(hb_FNameName(cDBF)), '_', '') + StrTran(hb_FNameName(cDBF), "-","_"))
msgdebug(alias())
EDIT EXTENDED

User avatar
serge_girard
Posts: 2361
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 607 times
Been thanked: 124 times
Contact:

Post by serge_girard » Sun Nov 03, 2019 4:21 pm

Thanks !

Serge

Post Reply