This class provides the methods that get the prefixes of the system names of tables and columns based on the current user application.

getTablePrefix() 


Use this method to get a prefix of the system name of the table based on the user's current application.

Note that this method is asynchronous; for better performance, use the await keyword, as in the code example below.

Return:

TypeDescription
ObjectThis method returns a Promise object that contains the table prefix.

Example:

getTablePrefix()
   if (s_form.isNewRecord()) {
            const promise = await ss.getTablePrefix();
            s_form.setValue('name', promise);
        }

getColumnPrefix(tableName)


Use this method to get the system column name prefix based on the table name.

Note that this method is asynchronous; for better performance, use the await keyword, as in the code example below.

Parameters:

NameTypeMandatoryDefault value
tableNameStringNN

Return:

TypeDescription
ObjectThis method returns a Promise object that contains the column prefix.

Example:

getColumnPrefix()
const table_id = s_form.getValue('table_id');
    if (table_id !== null) {
        (new SimpleRecord('sys_db_table')).get(table_id, (table) => {
            const column_prefix = await ss.getColumnPrefix(table.name);
            if (column_prefix) {
                const old_column_name = s_form.getValue('column_name');
                s_form.setValue('column_name', column_prefix + old_column_name);
            }
        });
    }

  • No labels