Your TestQ Procedure probably has a prototype of (*QUEUE Q2) so it has no idea of the structure.
For that Procedure to “understand” that Q2 has F1 and F2 you must pass it as a Named Queue which usually requires a TYPE Queue e.g. (*Q1_QUEUE_Type Q2) be defined in the scope for both procedures, usually global or an INC file.
thank you for your rapid reply.
sorry I tried the mentioned methods but it seems I am missing something. I am using clarion 6.3 if this counts…
my code is this:
!** LOCAL DATA GENERAL DECLARATION
QQ QUEUE,PRE(QQ)
F1 CSTRING(20)
F2 CSTRING(20)
END
!** LOCAL DATA OTHER DECLARATIONS (TRIED BOTH)
map
test Procedure(QUEUE)
!test Procedure(*QUEUE)
end
!** BUTTON ACCEPTED
Loop i#=1 to 100
qq:F1=i#
qq:F2=i#100
add(QQ)
end
!***********************
Test(qq)
!************************
stop(Records(qq))
!** LOCAL PROCEDURES
test procedure(Q1)
code
stop(records(Q1))
get(Q1,3)
stop(Q1) ! THE VLAUE OF QQ:F1
! stop(Q1.F1) !ERROR : FIELD NOT FOUND
! stop(Q1:F1) !ERROR : FIELD NOT FOUND
!------------------------------------------
Setting the Queue type in the parameter is a good approach where that option fits.
But you can actually access fields in a queue by number, instead of name. So you could have a generic function, that took a queue, and always worked on a specific numbered field. This is done with the WHAT command;
a any code a &= What(Q2,2)
It’s also possible to access fields by name, even if you don’t know the structure. This is done with the WHO command. (You loop through the fields using WHO until you find one with the right name, then use WHAT using that number.)
Here’s a Class with one call to QueueReflection() method that will open a Window and let you view any Queue. It uses WHO and WHAT to do this, plus the undocumented TUFO to get to the Type.
Recently wrote this simple procedure that uses WHO and WHAT to put a File’s records on the Clipboard Tab Delimited for paste into Excel.
TpsToTabDelimited PROCEDURE (*FILE AFile,<*KEY TheKey> ,STRING AFileLabel)
CBCsv ANY !Not CSV its Tab Delim
FldX LONG
Tb9 EQUATE('<9>')
What1 ANY
Date1 LONG
TheRecord &GROUP
CODE
TheRecord &= AFile{PROP:Record}
LOOP FldX=1 TO AFile{PROP:Fields} !Column Header line using WHO()
CBCsv=CHOOSE(FldX=1,'',CLIP(CBCsv) & Tb9) & Who(TheRecord,FldX)
END
IF OMITTED(TheKey)
SET(AFile)
ELSE
SET(TheKey)
END
LOOP !Column Data lines using WHO()
NEXT(AFile) ; IF ERRORCODE() THEN BREAK.
CBCsv=CLIP(CBCsv) & '<13,10>'
LOOP FldX=1 TO AFile{PROP:Fields}
What1 &= WHAT(TheRecord,FldX)
!Figure out what are DATE or LONG Date @d ?
!Maybe pass in list of Labels and check WHO. Use TUFO could see DATE but not LONG @d
CBCsv=CLIP(CBCsv) & CHOOSE(FldX=1,'', Tb9) & CLIP(What1)
END
END
SETCLIPBOARD(CBCsv)
Message('TPS File is on the Clipboard||' & Name(AFile))
RETURN
One problem is Dates are Clarion Serial numbers. Could pass string with List of Fields that are LONG @Date then the code could check INSTRING(WHO(), ListOfDates,1) THEN Format(What1, @d02).