` Printed Icetips Article

Icetips Article



ABC: Field data types being passed as any
1998-06-29 -- Jim Katz
 
Newsgroups: topspeed.products.c4

>     Just wanted to know if there is a way to determine what type a
> variable has been passed to an untyped variable parameter (either by
> value ("?") or by reference ("*?")). Ideally, I'd like to make a
> function that tests this without "bit fiddling".. that is, it "asks"
> Clarion for the original type. Is there something like that either as a
> Clarion command, API or...? All opinions greatly appreciated.

If its a field within a file, you can use the PROP:Type syntax to determine
the type. Unfortunately this property has not been extended, AFAIK,  to all
variables.. Here is some code off the top of my head, (not tested)

MyProc            PROCEDURE(*? PV,*File MyFile)
PassVar        ANY
FieldPos        BYTE
PassType       STRING(8)
  Code
  PassVar &= PV
  FieldPos = WHERE(MyFile.Record,PassVar)
  PassType = MyFile{PROP:Type,FieldPos)

HTH

--
Jim Katz



Printed November 23, 2024, 6:05 am
This article has been viewed/printed 35378 times.
Google search has resulted in 7 hits on this article since January 25, 2004.