epDBU DBF Administration tool

This forum is meant for anything you would like to share with other visitors
ic2
Posts: 2008
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Re: epDBU DBF Administration tool

Post by ic2 »

Hello Robert,
robert wrote: Sat Mar 28, 2026 8:23 am How did you declare bFor and bWhile?
There is a different in X# (and VO) between CodeBlock and _Codeblock. The first is for compile time codeblocks and the second for macro compiled code blocks.
It seems that it has been changed through time as the declaration looks as follows:

Code: Select all

LOCAL bFor, bWhile AS _CODEBLOCK //USUAL //CODEBLOCK
Unfortunately I have not documented why it changed. It must have been changed from Codeblock to _Codeblock to get it working at some time (which it did, at least 5 years ago) and it doesn't work anymore in the current X# version.

I checked my VO code and see that I only defined (compile time) codeblocks (not often used anyway), so not the _CodeBlock. But one (working) sample of using such a CodeBlock in VO is:

Code: Select all

lBlok1 := {||AScan(aRel,oDBDCSUb:FIELDGET(#relatie))<>0}
How could that codeblock then be resolved at compile time? Array aRel and the value from a DBF field are retrieved at execution time so that looks like a macro to me. How could that work then with AS CodeBlock ?

Dick
User avatar
robert
Posts: 5086
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: epDBU DBF Administration tool

Post by robert »

Dick,

Code: Select all

lBlok1 := {||AScan(aRel,oDBDCSUb:FIELDGET(#relatie))<>0}
This is a compile time code block.
Macros are strings that are converted into a codeblock at runtime
If you change the declaration to

Code: Select all

LOCAL bFor, bWhile AS CODEBLOCK 
then it works

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply