Tech Tip: Utility Method to List Tables Log Status
PRODUCT: 4D | VERSION: 15.3 | PLATFORM: Mac & Win
Published On: May 31, 2017
Below is a Utility Method that can be used to find which tables are being logged or not.
To use the method create three arrays for the table name, table number, and log status and pass a selector to filter the results if desired:
// Util_Get_Logged_List // // Details: // Utility Method to Return Arrays of Tables related to whether it is logged or not // // Parameters: // $1 - Pointer to Text Array to Contain Resulting Table Names // $2 - Pointer to Longint Array to Contain Resulting Table Numbers // $3 - Pointer to Boolean Array to Contain Resulting Log Status of Tables // $4 - Optional Selector to Filter Results // 0 - All Tables (Default) // 1 - List Only Tables That are Logged // -1 - List Only Tables That are NOT Logged // C_POINTER($1) ARRAY TEXT($tableName_at;0) C_POINTER($2) ARRAY LONGINT($tableNum_al;0) C_POINTER($3) ARRAY BOOLEAN($isLogged_ab;0) C_LONGINT($4) // 0 - All (Default C_LONGINT($selector_l) // 1 - True // -1 - False If (Count parameters>=3) If(Count parameters=3)  $selector_l:=0 Else $selector_l:=$4 End if Case of :($selector_l=0) Begin SQL SELECT TABLE_ID, TABLE_NAME, LOGGED FROM _USER_TABLES INTO :$tableNum_al, :$tableName_at, :$isLogged_ab; End SQL :($selector_l=1) Begin SQL SELECT TABLE_ID, TABLE_NAME, LOGGED FROM _USER_TABLES WHERE LOGGED=TRUE INTO :$tableNum_al, :$tableName_at, :$isLogged_ab; End SQL :($selector_l=-1) Begin SQL SELECT TABLE_ID, TABLE_NAME, LOGGED FROM _USER_TABLES WHERE LOGGED=FALSE INTO :$tableNum_al, :$tableName_at, :$isLogged_ab; End SQL End case COPY ARRAY($tableName_at;$1->) COPY ARRAY($tableNum_al;$2->) COPY ARRAY($isLogged_ab;$3->) End if |
To use the method create three arrays for the table name, table number, and log status and pass a selector to filter the results if desired:
ARRAY TEXT($tblName;0) ARRAY LONGINT($tblNum;0) ARRAY BOOLEAN($log;0) //All Tables Util_Get_Logged_List (->$tblName;->$tblNum;->$log) //Only Tables that are Logged Util_Get_Logged_List (->$tblName;->$tblNum;->$log;1) //Only Tables that are not Logged Util_Get_Logged_List (->$tblName;->$tblNum;->$log;-1) |