Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
3
Erster Beitrag:
vor 3 Jahren, 7 Monaten
Letzter Beitrag:
vor 3 Jahren, 7 Monaten
Beteiligte Autoren:
Al, Peter Holemans

[WD19] Heads up on possible change to {} indirection

Startbeitrag von Al am 24.11.2014 05: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

Antworten:

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.

von Peter Holemans - am 24.11.2014 08:12
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

von Al - am 24.11.2014 09:51
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.