KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Exporting table properties to a text file
PRODUCT: 4D | VERSION: 6.8 | PLATFORM: Win
Published On: July 10, 2002

While developing an application it is often useful to know table properties such as table numbers and Trigger settings.



The following code exports table properties to a text file for reference while working on an application:





C_STRING(1;$sTab;$sCR)

C_TIME(hDocRef)

C_TEXT($tTableProperties)

C_LONGINT($i)

C_BOOLEAN($fInvisible;$fTrigSaveNew;$fTrigSaveRec;$fTrigDelRec;$fTrigLoadRec)

C_STRING(5;$sInvisible;$sTrigSaveNew;$sTrigSaveRec;$sTrigDelRec;$sTrigLoadRec)



$sTab:=Char(Tab )

$sCR:=Char(Carriage return )

hDocRef:=Create document("TableProperties")



`Concatenate header row into export variable

$tTableProperties:="Table Nb"+$sTab+"Table Name"+$sTab+"Invisible"+$sTab

$tTableProperties:=$tTableProperties+"Trigger: On saving new record"+$sTab

$tTableProperties:=$tTableProperties+"Trigger: On saving existing record"+$sTab

$tTableProperties:=$tTableProperties+"Trigger: On deleting record"+$sTab

$tTableProperties:=$tTableProperties+"Trigger: On loading record"+$sCR

SEND PACKET(hDocRef;$tTableProperties)



For ($i;1;Count tables)



GET TABLE PROPERTIES($i;$fInvisible;$fTrigSaveNew;$fTrigSaveRec;$fTrigDelRec;$fTrigLoadRec)



If ($fInvisible)

 $sInvisible:="True"

Else

 $sInvisible:="False"

End if



If ($fTrigSaveNew)

 $sTrigSaveNew:="True"

Else

 $sTrigSaveNew:="False"

End if



If ($fTrigSaveRec)

 $sTrigSaveRec:="True"

Else

 $sTrigSaveRec:="False"

End if



If ($fTrigDelRec)

 $sTrigDelRec:="True"

Else

 $sTrigDelRec:="False"

End if



If ($fTrigLoadRec)

 $sTrigLoadRec:="True"

Else

 $sTrigLoadRec:="False"

End if



`Concatenate table properties into export variable

$tTableProperties:=String($i)+$sTab+Table name($i)+$sTab+$sInvisible+$sTab+$sTrigSaveNew+$sTab

$tTableProperties:=$tTableProperties+$sTrigSaveRec+$sTab+$sTrigDelRec+$sTab+$sTrigLoadRec+$sCR

SEND PACKET(hDocRef;$tTableProperties)



End for



CLOSE DOCUMENT(hDocRef)

BEEP