PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD19] Heads up on possible change to {} indirection
[WD19] Heads up on possible change to {} indirection
Iniciado por guest, 24,nov. 2014 06:59 - 2 respuestas
Publicado el 24,noviembre 2014 - 06:59
Hello All

I know that PCSoft released a set of indirection inidicators some time ago, but I never bothered going back over my old code, but V19 must parse indirections slightly differently to previous versions. I have one data file where the name of the file "Issued" matches the name of a date field in the file that is also called "Issued". I appreciate this is probably not a good idea, but it has not caused any problems until now.

All the versions prior to version 19 were able to run the following code successfully
HRead({FileName},CurrentRecNum)
In V19 the field value for "Issued" was substituted instead of the actual file name so the program crashed.

Setting the indirection indicator fixed the problem
HRead({FileName,indFile},CurrentRecNum)

Regards
Al
Publicado el 24,noviembre 2014 - 09:12
Hi Al,

If I am not mistaking you don't need indirection here...
You can use:
FName is string = "DBTableName" //or DBTable..Name
IF HRead(FName, CurrentRecNum) THEN
...
ELSE
...
END

As a rule of thumb you can use the following strategy:
If the help states it is possible to pass a quoted string as a parameter, you don't need indirection.

On the other hand you should always specialize any indirection since not doing see will make your program noticeably slower.
So, if you use indirection always pass the second parameter, limiting the scope the runtime should look through to match the item concerned.

Just my 2 cents,

Peter H.
Publicado el 24,noviembre 2014 - 10:51
Hello Peter

Thank you for the tip, it worked as you suggested.

That particular piece of code started life in 2002 as a global procedure called as part of a record modify process. I might start clearing old comments out now as there are more comments than code in some of my old work, but it is interesting to see how things change as the software evolves.

Regards
Al