PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → WD[20] Halias() code works with HFClassic does not work with HFCS
WD[20] Halias() code works with HFClassic does not work with HFCS
Iniciado por guest, 17,feb. 2016 04:02 - 3 respuestas
Publicado el 17,febrero 2016 - 04:02
Hello All

We have moved some clients from HFClassic to HFCS and a number of programs have stopped working as they should. In each case it involves the use of HAlias() and copying from a file to itself using the alias.
This is a snippet of the code
EstRefAlias is Data Source HAlias(EStRef, EstRefAlias) HChangeName(EstRefAlias, "EstRef") HFilter(EstRefAlias,"ESCLEUNIK",LCopyFromEstimateCle) HReadFirst(EstRefAlias,"ESCLEUNIK") WHILE NOT HOut(EstRefAlias) HCopyRecord(EstRef,EstRefAlias) EstRef.ESCLEUNIK = LCopyToEstimateCle RecordAdd("EstRef") //other code HReadNext(EstRefAlias,"ESCLEUNIK") END //WHILE NOT HOut(EstRefAlias)

After the HReadNext, the file does not go to the next record. It stays on the starting record and the code after the End is executed so it is only processing the first record. Clearly the HFCS engine cannot cope with using the same file as an aliased source of itself and then copying between the AliasFile and the original file but the same code executes fine in HFClassic. Changing the code around to use a view or a query as the source file works fine with the HFCS.
I thought the whole point of the HAlias() function was to create a completely separate view of a file that then could be addressed independently of the source file. This the case in HFClassic but not in HFCS. I use this method in a few places in my applications and on checking, they all fail under HFCS.

Has anyone else seen this behaviour or has a solution ? At the moment I am going through my code looking for similar examples so I can change them

Regards
Al
Publicado el 17,febrero 2016 - 13:26
Hi Al,
in HF C/S you must do a small change to your code:

PartyMain_alias is Data Source
HAlias(PartyMain,PartyMain_alias)
HChangeConnection(PartyMain_alias ,myconnect) //only necessary if using a connection
HChangeName(PartyMain_alias, "PartyMain")

where myconnect is your connection

Steven Sitas
Publicado el 17,febrero 2016 - 19:29
Hello Steven

Thanks for the solution.

Regards
Al
Publicado el 18,febrero 2016 - 02:15
Hello Steven

I tried using HChangeConnection(PartyMain_alias ,myconnect) //only necessary if using a connection as suggested but it made no difference.
I establish the connection named "HyperFileCS" and use it to connect to the HFCS when the exe loads and I nominated the same connection name in the HChangeConnection(QTLinesAlias,HyperFileCS)
I will have go back to using a view or a query to hold the alias

Thanks anyway

Regards
Al