` Textize
` Returns the text equivalent of what was passed
` $1 - Pointer to the variable to be Textized
` $2 - True if to be returned with "quotes" of the proper type (ie ?10/28/57?)
` $3 - Delimiter if passing an array
` <>QU is defined in the database as Char(34)
C_POINTER($1;$ObjectPtr;$ElementPtr)
C_TEXT($3;$0;$Text;$QU;$Delimiter;$ArrayName)
C_BOOLEAN($2)
C_LONGINT($Type;$Ndx;$TableNum;$FieldNum)
$ObjectPtr:=$1
$Type:=Type($ObjectPtr->)
If (Count parameters>=2)
$AddQuotes:=$2
Else
$AddQuotes:=False
End if
Case of
: (($Type=Is Alpha Field ) | ($Type=Is String Var ) | ($Type=Is Text )) ` Just return the string
$Text:=$ObjectPtr->
$QU:=<>QU
: (($Type=Is Real ) | ($Type=Is Integer ) | ($Type=Is LongInt )) ` Convert to string
$Text:=String($ObjectPtr->)
$QU:=""
: ($Type=Is Time ) ` Convert to string
$Text:=String($ObjectPtr->)
$QU:="?"
: ($Type=Is Date ) ` Convert to string
$Text:=String($ObjectPtr->)
$QU:="!"
: ($Type=Is Boolean )
If ($ObjectPtr->)
$Text:="True"
Else
$Text:="False"
End if
$QU:=""
: (($Type=Boolean array ) | ($Type=Date array ) | ($Type=Integer array ) | ($Type=LongInt array ) | ($Type=Real array ) | ($Type=String array ) | ($Type=Text array ))
$Delimiter:=$3
$Text:=""
For ($Ndx;1;Size of array($ObjectPtr->))
RESOLVE POINTER($ObjectPtr;$ArrayName;$TableNum;$FieldNum)
$ElementPtr:=Get pointer($ArrayName+"{"+String($Ndx)+"}")
$Text:=$Text+$Delimiter+Str_Textize ($ElementPtr;$AddQuotes)
End for
If (Length($Text)>0)
$Text:=Substring($Text;2)
End if
$AddQuotes:=False ` We don't want quotes around the whole list even if the elements got them
Else
$Text:="" ` For the ones that can't be converted (ie, 2D arrays, BLOBs, etc.)
$QU:=""
End case
If ($AddQuotes)
$Text:=$QU+$Text+$QU
End if
$0:=$Text