` Printed Icetips Article

Icetips Article



Par2: PRE() on Queues and referring to queue fields
1999-06-20 -- Carl Barnes
 
In CW20 something called Field Qualification was added to the Clarion Language but 
not the IDE. See the LRM for some info. It replaces the use of Prefixes by using the 
higher level name of the GROUP or QUEUE plus a Dot plus the field name. This is also 
called Dot Syntax. This is the prefered way to access structures now.

E.g. in this structure:

FilesQ      QUEUE
Name          STRING(20)
Date            LONG
                END

To use the Name variable you type FileQ.Name. Trouble is that previous to Cw20 you 
could just use "Name". To solve this syntax problem they changed the rules a bit, you 
have to add a blank prefix, i.e. PRE(). With PRE() you can still call it "Name" and also 
call it FileQ.Name. But the empty PRE() is being Deprecated, i.e. it's a legacy.

Enter another problem, the IDE does not support Field Qualification and it does not 
support prefixes. Thru the Data button you can only do PRE() or more correct, you 
cannot enter a prefix. Oddly this was supported in 3.0 DOS.

So you need to make unique field names, sorry but thats the way it is. It is very livable.

I tend to add a Prefix to each field name so I would enter the above group under Data 
as:

FilesQ      QUEUE
FQ:Name          STRING(20)
FQ:Date            LONG
                END

Starting in C5B they have added PRE() to the Data button IDE. And they are working on 
doing Dot.syntax thru the IDE. So the future is good. C5b should ship shortly.

To summarrize:
1. Prior to C5B thru the IDE all GROUP and QUEUE use PRE() so you must have
unique field names. It's not that tuff.
2. When you hand code your QUEUE in the Data embeds then if you leave off
PRE() you must use QueueName.Fieldname dot.syntax.
3. When you hand code your QUEUE in the Data embeds and you use PRE(XXX) you
can use XXX:FieldName or QueueName.Fieldname dot.syntax.

Your #2 problem of wanting to create a Queue thru the DATA button without a
PRE() is a good one, the reason you cannot is that the IDE does not support
dot.syntax. So make your prefix name the same as your Queue name.

Your #3 problem I just checked in C5Bv the lastest alpha build and I was
allowed to create two Queues with different prefixes and the same field
names. Here's what I did:
Q1    QUEUE,PRE(Q1)
NAME    string(20)
         .
Q2    QUEUE,PRE(Q2)
NAME    string(20)
         .

One possible bug you should be aware of is that Reference variables and
Reference assignments do not support the blank PRE(). You must use
field.qualification. The compiler will take some of them but they will not
work. So if you have a group

MyG  GROUP,PRE()
MG:WinRef      &Window
         END

Even if MG:WinRef is unique you must use MyGroup.MG:WinRef &= Window



Printed November 21, 2024, 6:35 am
This article has been viewed/printed 35294 times.