f2s_table_override_state¶
Applies to: Oracle, MS SQL, MySql, MariaDB, PostgreSQL Drivers
Syntax¶
set_attribute f2s_table_override_state of {FileNumber} to {variable}
get_attribute f2s_table_override_state of {FileNumber} to {variable}
Parameter |
Description |
---|---|
FileNumber |
Number of the file (filename.File_Number) |
variable |
Boolean Variable. True, the f2s_column_override_value` is used, |
Description¶
This boolean attribute determines if the value in f2s_column_override_value is used as an automatic constraint on the table.
When set to true
, find operations will have an automatic constraint based on the value for of any f2s_column_override_value’s
(there could be multiple columns with override values). This is useful in multi-company setups as it will effectively limit the table to
a subset of records. If f2s_table_override_state
is false
then finds act as they normally do.
The default value for this attribute is false.
Note
If f2s_table_constraint is used on the table, then it overrides the f2s_table_override_state
and you must remember to manually
add your constraints if they apply.
Examples¶
get_attribute
boolean bOverRide
Get_Attribute f2s_table_override_state of CUSTOMER.File_Number to bOverRide
set_attribute
In this example, the field Company has been added to the Customer table. For all, save one, of the records, the Company value has been set to “Some Company”. There is one record where the Company value is “Another Company”. When the f2s_column_override_value attribute is set for the Company field to “Another Company” and the f2s_table_override_state attribute is set to true, only that one record is returned in the find.
Integer FieldNum
Open customer
Field_Map CUSTOMER.File_Number "Company" to FieldNum
//Set the default for the Company name
Set_Attribute f2s_column_override_value of CUSTOMER.File_Number FieldNum to "Another Company"
Set_Attribute f2s_table_override_state of CUSTOMER.File_Number to true
//do a find
Clear CUSTOMER
Find ge CUSTOMER by Index.1
While (Found)
Showln (SFormat("Customer: %1; Company %2", Trim(CUSTOMER.NAME), Trim(CUSTOMER.Company)))
Find gt CUSTOMER by Index.1
Loop
Replaces¶
SET_SQL_CONSTRAINT using the option FROM_PROGRAMMATIC_DEFAULTS