Tech Tip: A Method to see if a Table or Field is exposed to 4D Mobile
PRODUCT: 4D | VERSION: 14.3 | PLATFORM: Mac & Win
Published On: February 5, 2015
Below is a method that will return whether a table or field is exposed to 4D Mobile Services (REST Services in older versions.)
// Method: GetMobileExposure // Details: Returns True if passed table or field is exposed to 4D Mobile/REST Services // Parameters: // $1 - Table ID // $2 - Field ID, Optional // if not passed method will check the table passed // if passed method will check the field in the table passed C_LONGINT($1;$table_id_l) C_LONGINT($2;$column_id_l) C_BOOLEAN($0;$exposed_b) If (Count parameters>=1) $table_id_l:=$1 Case of : (Count parameters=1) Begin SQL SELECT REST_AVAILABLE FROM _USER_TABLES WHERE TABLE_ID = :$table_id_l INTO :$exposed_b; End SQL : (Count parameters>=2) $column_id_l:=$2 Begin SQL SELECT REST_AVAILABLE FROM _USER_COLUMNS WHERE TABLE_ID = :$table_id_l AND COLUMN_ID = :$column_id_l INTO :$exposed_b; End SQL End Case $0:=$exposed_b End if |
Below is an example of using the method to determine if tables and fields are exposed with 4D Mobile Services.
Given that:
Table 1 is exposed with 4D Mobile/REST Services
Table 1 Field 1 is exposed with 4D Mobile/REST Services
Table 1 Field 2 is not exposed with 4D Mobile/REST Services
Table 2 is not exposed with 4D Mobile/REST Services
$var1:=GetMobileExposure(2) // $var1 is False $var2:=GetMobileExposure(1) // $var2 is True $var3:=GetMobileExposure(1;1) // $var3 is True $var4:=GetMobileExposure(1;2) // $var4 is False |