Welcome! Log In Create A New Profile

Advanced

Using hAlias. (SOLVED)

Posted by AadG 
Using hAlias. (SOLVED)
December 21, 2021 02:39PM
Hi all,

Maybe somebody can help me with the following. I'm using HAlias on a certain file. That works fine. When I copy a record from the oribginal file to the alias with hAdd(AliasFile) I get an error. "This function is not available for an element of 'UNICODE string' type". Does anybody know what this means, specially the unicode string. I'm using a memofield. Can this be the fault trigger. I use hCopyrecord to copy the record into the alias file.

Best regards,

Aad

EDIT * I tried everything, but nothing worked. I removed the code hAdd(Aliasfile) and put it in again. Problem solved. angry smiley



Edited 3 time(s). Last edit at 12/22/2021 01:09PM by AadG.
Argus
Re: Using hAlias. (SOLVED)
December 22, 2021 01:51PM
I think it's as simple as that:

hadd is waiting for a file name or an ANSI string variable containing a file name
You must have declared AliasFile as unicode (or be in unicode configuration)
Re: Using hAlias. (SOLVED)
December 26, 2021 02:46PM
LOCAL
	dsDataSource		is Data Source <description=products>
	sFileName		is string = "products"
	ctKassaLokal		is Connection
	bRes			is boolean
	bHFCSConnected		is boolean = True
	sDataDir		is string = CompleteDir(fExeDir())
	
HAlias(sFileName, dsDataSource)

HChangeName(dsDataSource,{sFileName,indFile}..DescribedPhysicalName) //Important!

IF bHFCSConnected THEN
	
	ctKassaLokal..Access	= hOReadWrite
	ctKassaLokal..Database	= "TESTDB"
	ctKassaLokal..User		= "admin"
	ctKassaLokal..Password	= "password"
	ctKassaLokal..Server	= "localhost:4900"
	
	bRes					= HOpenConnection(ctKassaLokal)
	HChangeDir(dsDataSource, "")
	HChangeConnection(dsDataSource, ctKassaLokal)
	
ELSE
	
	HChangeDir(dsDataSource, sDataDir)
	
END

HReadFirst(products, prod_no)
WHILE NOT HOut(products)
	HReadSeek(dsDataSource, prod_no, products.prod_no, hIdentical)
	IF HFound(dsDataSource) THEN
		Trace(dsDataSource.prod_no + ", ", + dsDataSource.prod_description)
	END
	HReadNext(products, prod_no)
END

HCancelAlias(dsDataSource)
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: