System Functions

1. Common utility functions

Function Name Description
ew_Throw(message) (v10+) Throw an error message
Parms
 message - error message
ew_IncludeTrailingPathDelimiter(path) (v10+) Return a path with trailing path delimiter
Parms
 path - file path
ew_GetLanguageFileId(file) (v10+) Return language file id
Parms
 file - language file name
ew_LinkDBExist(dbid) (v10+) Return if the link database exists
Parms
 dbid - link database id
ew_GetLinkDB(dbid) (v10+) Return link db object
Parms
 dbid - link database id
ew_GetDbId(tablename) (v9+) Return database id for table name
Parms
 tablename - table name
ew_DbType(dbid) (v9+) Return database type for database id
Parms
 dbid - database id
ew_IsAutoSuggest(fld) (v8+) Return if field is auto suggest field
Parms
 fld - field object
ew_UseForLabel(fld) (v8+) Return if field use for label
Parms
 fld - field object
ew_HasUserTable() (v8+) Return if user table used
ew_IsNotEmpty(val) (v6+) Return if value is not empty
Parms
 val - value
ew_IsEmpty(val) (v6+) Return if value is empty
Parms
 val - value
ew_InArray(val, ar) (v6+) Return if value is in array
Parms
 val - value
 ar - array
ew_FormObj(ctlid) (v6+) Return form object name
Parms
 ctlid - control id
ew_SqlSelect(tbl, sSelectLimit, sDistinct, sSelect, sFrom) (v6+) Return SQL SELECT statement
Parms
 tbl - table object
 sSelectLimit - SELECT LIMIT part
 sDistinct - use SELECT DISTINCT
 sSelect - SELECT part
 sFrom - FROM part
ew_CustomScriptRowCnt() (v8+)
Return custom template row count
ew_CustomScriptRowCntVar() (v8+)
Return custom template row count variable
ew_CustomScriptGroupVar() (v7+)
Return custom template group variable
ew_CustomScriptRowVar() (v7+)
Return custom template row variable
ew_CustomScriptGroupIndex(fld, cnt, grp) (v7+)
Return custom template group index
Parms
 fld - field object
 cnt - group count
 grp - grouping field or not
ew_CustomScriptId(name, type ,idx) (v7+)
Return custom template script id
Parms
 name - script name
 type - script type
 idx - row index
ew_CustomScriptTag(name, type, classname, idx) (v7+)
Return custom template script tag
Parms
 name - script name
 type - script type
 classname - class name
 idx - row index
ew_GetJsScript(html) Return javascript from html
Parms
 html - html content
ew_RemoveJsScript(html) Remove javascript from html
Parms
 html - html content
ew_GetFieldHtmlTag(f) (v6+) Return field html tag
Parms
 f - field object
ew_NullIfFunction(fld) (v6+)
Return SQL NULLIF function for different database type
Parms
 fld - field SQL
ew_CastFieldForLike(fld, type, dtfmt) (v6+) Return SQL that cast non-string field for LIKE statement
Parms
 fld - field SQL
 type - field type
 dtfmt - date format
ew_ContainsText(Str, Find) Return True if "Find" in "Str"
Parms
 Str - Source string
 Find - Find string
ew_SameText(Str1, Str2) Return True if same text (case insensitive)
Parms
 Str1 - first string
 Str2 - second string
ew_HasTagValue(fld, val) Return if field contains tag value
Parms
 fld - field object
 val - tag value
ew_FldTagValues(fld) Return field tag values
Parms
 fld - field object
ew_SplitTagValues(str) Return an array of tag values
Parms
 str - "value 1","value 2",...
ew_IsBinaryField(Fld) Return True if field is binary
Parms
 Fld - field object
ew_SummaryValueName(id) Return summary value name
- (SumValue / AvgValue / MinValue / MaxValue)
Parms
 id (String) - Sum/Avg/Min/Max
ew_SummaryViewValueName(id) Return summary view value name
- (SumViewValue / AvgViewValue / MinViewValue / MaxViewValue)
Parms
 id (String) - Sum/Avg/Min/Max
ew_GetTblObj(tablename) (v10+) Return table object if exists. Otherwise return null.
Parms
 tablename - table name
ew_GetChtObj(t, chtname) (v10+) Return chart object if exists. Otherwise return null.
Parms
 t - table object
 chtname - chart name
ew_GetFldObj(t, fldname) (v10+) Return field object if exists. Otherwise return null.
Parms
 t - table object
 fldname - field name
ew_GetCtrlObj(ctrlid) (v10+) Return control object if exists. Otherwise return null.
Parms
 ctrlid - control id
ew_GetExtObj(extname) (v10+) Return extension object if exists. Otherwise return null.
Parms
 extname - extension name
ew_GetExtTbl(extname, tblname) (v10+) Return extension table object if exists. Otherwise return null.
Parms
 extname - extension name
 tblname - table name
ew_GetExtCht(extname, tblname, chtname) (v10+) Return extension chart object if exists. Otherwise return null.
Parms
 extname - extension name
 tblname - table name
 chtname - chart name
ew_GetExtFld(extname, tblname, fldname) (v10+) Return extension field object if exists. Otherwise return null.
Parms
 extname - extension name
 tblname - table name
 fldname - field name
ew_GetExtPrp(prps, prpid) (v10+) Return extension property value
Parms
 prps - properties array
 prpid - property id
ew_GetObjByName(name) (v10+) Return object
Parms
 name - object name
ew_CssInherit(parm) Return "inherit" if parm is empty
ew_AddSquareBrackets(varname, fld) Add square brackets to variable
Parms
 varname - variable name
 fld - field object
ew_PageObj() Return page object name
ew_GetPageObjByCtrlId(ctlid) (v6+) Return page object name based on control id
Parms
 ctlid - control id
ew_GetCtrlById(id) (v6+) Return control object based on control id
Parms
 ctlid - control id
ew_Val(v) Return PHP TRUE/FALSE value
Parms
 v - boolean value
ew_JsVal(v) Return JavaScript true/false value
Parms
 v - boolean value
ew_RandomKey() Return random key
ew_FolderPath(id) Return folder path
Parms
 id - control id
ew_GetFileNameByCtrlID(id) Return file name based on control id
Parms
 id - control id
ew_RelFolder(f) Return relative folder to current output folder
Parms
 f - folder path
ew_RelPath(f1, f2) Return relative folder of f1 to f2
Parms
 f1 - folder path 1
 f2 - folder path 2
ew_OutputRelPath(f) (v8+) Return output relative folder
Parms
 f - folder path
ew_DestRelPath(f) (v8+) Return relative folder to destination folder
Parms
 f - folder path
ew_AppRootRelPath(f) (v8+) Return relative folder to application root
Parms
 f - folder path
ew_EscapeString(sSrc, sEsc) Return escaped string
Parms
 sSrc - source string
 sEsc - escape string
 (double quote for VB, backslash for JS)
ew_DoubleQuote(str, cnt) Return double quoted string
Parms
 str - source string
 cnt - quote count
ew_Quote(str) Escape double quote in string
Parms
 str - source string
ew_Quote2(str) Escape double quote in string (including $ sign)
Parms
 str - source string
ew_SQuote(str) Escape single quote in string
Parms
 str - source string
ew_UnQuote(str) Remove embracing single/double quotes in string
Parms
 str - source string
ew_GetFieldType(fType) Return field type based on ADO field type
Parms
 fType - ADO Field Type
Output
 1 - Numeric
 2 - Date
 3 - String
 4 - Boolean
 5 - GUID
 6 - Others
 7 - Time
ew_IsDbGrpFld(grptype) Return True if database group type
Parms
 grptype - "f", "i", "y", "q", "m", "w", "d", "h", "min"
ew_DbGrpSql(grptype, grpint) Return grouping SQL
Parms
 grptype - "f", "i", "y", "q", "m", "w", "d", "h", "min"
 grpint - grouping interval ("f" / "i" types only)
ew_BoolFieldTagValues(ftype, tagvalues) Return tag values for Boolean field
Parms
 ftype - ADO Field Type
 tagvalues - original tag values
ew_SQLPart(sSQL, sId) Return part of the SQL
Parms
 sSQL - original SQL
 sId - token for different part of SQL
(SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT)
ew_RecPerPageList(sList, iRec) Return record per page list (comma separated)
Parms
 sList - original record per page list
 iRec - default record per page
ew_ChartCount(Pos) Return number of charts in position
Parms
 Pos - 1 (Top), 2 (Left), 3 (Right), 4 (Bottom), Not specified (All)
ew_FieldSqlName(fld) Return the sql name for the field
Parms
 fld - field object
ew_TableName(tbl) Return the sql table name
Parms
 tbl - table object
ew_QuotedName(name) Return the properly quoted sql name
Parms
 name - table/field name
ew_EscapeRegExChars(str) (v10+) Escape the regular expression
Parms
 str - regular expression string
ew_IsDateFilter(f) (v6+) Return true if field is enabled for date filter
Parms
 f - field object
ew_IsPopupFilter(f) (v6+) Return true if field is enabled for popup filter
Parms
 f - field object
ew_IsFieldDrillDown(f) (v6+) Return true if field is enabled for drill down report
Parms
 f - field object
ew_FieldDrillDownUrl(f) (v6+) Return field drill down url
Parms
 f - field object
ew_IsChartDrillDown(cht) (v6+) Return true if chart is enabled for drill down report
Parms
 cht - chart object
ew_ChartDrillDownUrl(cht) (v6+) Return chart drill down url
Parms
 cht - chart object
ew_DateSql(f) (v6+) Return date SQL
Parms
 f - field object
ew_EncodeName(Name) Encode name in alphabeticnumeric
Parms
 Name - Source name
ew_CodeBaseExist(ScriptType, CodeType, Name) (v10+) Return if code base exists
Parms
 ScriptType - script type
 CodeType - code type
 Name - script name
ew_CodeBaseItem(ScriptType, CodeType, Name) (v10+) Return code base item
Parms
 ScriptType - script type
 CodeType - code type
 Name - script name
ew_ScriptExist(ScriptType, CodeType, Name, CtrlID, L1Key, L2Key) (v10+) Return if custom script exists
Parms
 ScriptType - script type
 CodeType - code type
 Name - script name
 CtrlID - control id
 L1Key - table key
 L2Key - field key
ew_ScriptItem(ScriptType, CodeType, Name, CtrlID, L1Key, L2Key) (v10+) Return custom script item
Parms
 ScriptType - script type
 CodeType - code type
 Name - script name
 CtrlID - control id
 L1Key - table key
 L2Key - field key
ew_ConvertData(v, t) (v10+) Get converted data
Parms
 v - original value
 t - value type (Boolean/Integer/Long/Single/Double)
ew_LoadChart(chtname) (v10+) Load chart object by name
Parms
 chtname - chart name
ew_GetFieldTypeName(FldTyp) (v10+) Get data type name (EWR_DATATYPE_*)
Parms
 FldTyp - ADO field type
ew_LoadField(fldname) (v10+) Load field object by name
Parms
 fldname - field name
ew_GetFldVal(tbl, fld, fldtype) (v10+) Get field value expression
Parms
 tbl - table object
 fld - field expression
 fldtype - field type
ew_GetSearchDefaultValue() (v10+) Get search default value
ew_GetDropdownDefaultValue() (v10+) Get dropdown default value
ew_IsArrayString(str) (v10+) Check if string is array(...) or array[...]
Parms
 str - input string
ew_IsAggregateSql(sql) (v10+) Check if SQL contains (SUM/AVG/MIN/MAX/COUNT)
Parms
 sql - input SQL string
ew_GetFieldValues(f) (v10+) Return field value list
Parms
 f - field object
ew_ActivateFieldValue(t, f) (v10+) Return activate field value
Parms
 t - table object
 f - field object
ew_IsExtendedFilter(f) (v10+) Check if extended filter enabled
Parms
 f - field object
ew_IsTextFilter(f) (v10+) Check if text filter enabled but not modal lookup/auto suggest
Parms
 f - field object
ew_IsTextFilter2(f) (v10+) Check if text filter enabled
Parms
 f - field object
ew_IsBooleanCheckboxFilter(f) (v10+) Check if boolean checkbox field
Parms
 f - field object
ew_IsAutoSuggestFilter(f) (v10+) Check if auto suggest field
Parms
 f - field object
ew_IsUseAjax(f) (v10+) Check if use ajax
Parms
 f - field object
ew_IsUseAjax(f) (v10+) Check if use ajax
Parms
 f - field object
ew_IsShowChart(cht, pos) (v10+) Check if show chart in position
Parms
 cht - chart object
 pos - top/left/right/bottom (1/2/3/4)
ew_IsPopupCalendar() (v10+) Check if any popup calendar is enabled
ew_FieldTDHeader(f) (v10+) Return field header style
Parms
 f - field object
ew_FieldCellStyle(f) (v10+) Return field cell style
Parms
 f - field object
ew_FieldViewStyle(f) (v10+) Return field view style
Parms
 f - field object
ew_CharsetToIconvEncoding(Charset) (v10+) Get Iconv encoding from charset
Parms
 Charset - charset name
ew_CharsetToMySqlCharset(Charset) (v10+) Get MySQL charset from charset
Parms
 Charset - charset name
ew_IsMsAccess() (v10+) Return if main database is MS Access
ew_IsMsSQL() (v10+) Return if main database is Microsoft SQL Server
ew_IsMySQL() (v10+) Return if main database is MySQL
ew_IsPostgreSQL() (v10+) Return if main database is PostgreSQL
ew_IsOracle() (v10+) Return if main database is Oracle
ew_GetOracleServiceName(ConnStr) (v10+) Get Oracle service name from connection string
Parms
 ConnStr - connection string
ew_UseEmailExport() (v10+) Check if export to email is enabled for any table
ew_UsePdfExport() (v10+) Check if export to PDF is enabled for any table
ew_UseJSTemplate() (v10+) Check if custom template is enabled for any table
ew_UseModalLookup() (v10+) Check if modal lookup is enabled for any field
ew_IsExport() (v10+) Check if export is enabled for any field
ew_GetProjCssFileName() (v10+) Get project CSS file name
ew_IsFCFChart(typ) (v10+) Check if chart type is FusionCharts Free
Parms
 typ - chart type
ew_UsePhpExcel() (v10+) Check if PHP Excel is enabled
ew_UsePhpWord() (v10+) Check if PHP Word is enabled
ew_HasDrillDownParm(t) (v10+) Check if Table has drill down parameter
Parms
 t - table object
ew_IsDrillDownSource(t, f) (v10+) Check if Drill Down source field
Parms
 t - table object
 f - field object
ew_IsCustomFld(f) (v10+) Check if custom field
Parms
 f - field object
ew_UseADOdb() (v10+) Return if use ADOdb

2. Overridable Functions

USAGE: SYSTEMFUNCTIONS.<FunctionName>

Function Name Description
Charset() Return meta tag for charset specified
FavIcon() Return <link> tags for favicon specified
CssFile() Return <link> tag for css file specified
GetScript(scripttype,codetype,scriptname) Return server/client scripts
Parms
 scripttype - script type (Server / Client)
 codetype - code type (Global / Table / Other)
 scriptname - script name
GetServerScript(codetype,scriptname) Return server scripts
Parms
 codetype - code type (Global / Table / Other)
 scriptname - script name
GetClientScript(codetype,scriptname) Return client scripts
Parms
 codetype - code type (Global / Table / Other)
 scriptname - script name
ScriptExist(scripttype,codetype,scriptname) Return if server event / client script exists
Parms
 scripttype - script type (Server / Client)
 codetype - code type (Global / Table / Other)
 scriptname - script name
ServerScriptExist(codetype,scriptname) Return if server event exists
Parms
 codetype - code type (Global / Table / Other)
 scriptname - script name
ClientScriptExist(codetype,scriptname) Return if client script exists
Parms
 codetype - code type (Global / Table / Other)
 scriptname - script name
CustomTemplateExist() (v7+)
Return if custom template exists
GetCustomTemplate() (v7+)
Return custom template codes
ParseTemplate(template,templateid) (v7+)
Pase and return custom template content
Parms
 template - template source codes
 templateid - template id
RenderCustomTemplate() (v7+)
Return codes that render the custom template
GetTemplateScript(CodeType,ScriptName) (v7+)
Return template scripts
Parms
 codetype - code type (Table)
 scriptname - template name
GetCustomViewTemplate(fld) (v7+)
Return custom view template for field
Parms
 fld - field object
IsBoolFld() Return if field is boolean
PHPCgiPath() Return CGI path
NoCache() Return PHP no cache codes
IncludeFile(id,parm) Return PHP include file statement
Parms
 id - control id
 parm - "compat" to generate compat header/footer
Security() Return security checking codes
ScriptSummaryViewRefer() Return PHP codes for rendering summary field for VIEW (HREF)
ScriptViewRefer() Return PHP codes for rendering field for VIEW (HREF)
ScriptGroupView() Return PHP codes for rendering grouping field for VIEW
ScriptGroupSummaryView() Return PHP codes for rendering grouping field for VIEW (Summary)
ScriptView() Return PHP codes for rendering field for VIEW
ScriptSummaryView(id) Return PHP codes for rendering field for VIEW (Summary)
Parms
 id - Sum/Avg/Min/Max
ScriptViewCall(cv, vv, dtl) Return PHP codes for rendering field for VIEW
Parms
 cv - current value
 vv - view value
 dtl - detail field
ScriptViewNo(cv, vv) Return PHP codes for rendering field for VIEW (AutoNumber field)
ScriptViewText(cv, vv) Return PHP codes for rendering field for VIEW (TEXT field)
ScriptViewFormat(parm) Return PHP codes for field VIEW TAG format
Parms
 parm - field to be formatted
ScriptViewPassword(cv, vv) Return PHP codes for rendering field for VIEW (PASSWORD field)
ScriptViewValues(cv, vv) Return PHP codes for rendering field for VIEW (Lookup Value field)
ScriptViewTextarea(cv, vv) Return PHP codes for rendering field for VIEW (TEXTAREA field)
ScriptViewHidden(cv, vv) Return PHP codes for rendering field for VIEW (HIDDEN field)
ScriptViewFile(cv, vv) Return PHP codes for rendering field for VIEW (FILE field)
ScriptViewHref(cv, vv) Return PHP codes for rendering field for VIEW (HREF field)
FieldSummaryGroupView() Return field control for Summary Group VIEW
FieldGroupView() Return field control for Group VIEW
FieldSummaryView(id, lvl) Return field control for Summary VIEW
Parms
 id - summary id
 lvl - group level
FieldView() Return field control for VIEW
FieldViewCall(cv, vv, id, lvl) Return field control for VIEW
FieldViewCheckbox(cv, vv, id, lvl) Return field control for VIEW (CHECKBOX field)
FieldViewText(cv, vv, id, lvl) Return field control for VIEW (TEXT field)
FieldViewFile(cv, vv, id, lvl) Return field control for VIEW (FILE field)
FieldViewHref(ctl, vv) Return field control for VIEW (HREF field)
Parms
 ctl - control to be HREF
FieldSearch() Return extended filter textbox 1
FieldSearch2() Return extended filter textbox 2
FieldSearchLookup(autopostback) Return field control for search lookup field
Parms
 autopostback - auto post back the search form after selection
FieldSearchRadio(ctl, autopostback) Return field control for search lookup field (RADIO)
Parms
 ctl - field control
 autopostback - auto post back the search form after selection
FieldSearchCheckbox(ctl, autopostback) Return field control for search lookup field (CHECKBOX)
Parms
 ctl - field control
 autopostback - auto post back the search form after selection
FieldSearchSelect(ctl, autopostback) Return field control for search lookup field (SELECT)
Parms
 ctl - field control
 autopostback - auto post back the search form after selection
FieldSearchModalLookup(ctl, autopostback) (v10+) Return field control for search modal lookup field
Parms
 ctl - field control
 autopostback - auto post back the search form after selection
FieldSearchAjax(ctl, autopostback) Return field control for search lookup field (AJAX)
Parms
 ctl - field control
 autopostback - auto post back the search form after selection
FieldSearchAjax2() (v10+) Return script for search lookup field (AJAX)
FieldEditText(ctl, val) Return field control for EDIT (TEXT field)
Parms
 ctl - control
 val - value
FieldEditText2() (v10+) Return script for EDIT (TEXT field)
FieldOperator() Return extended filter field operator 1
FieldOperator2() Return extended filter field operator 2
FieldOperatorCall(ctl, val, opr) Return extended filter field operator based on parameter
Parms
 ctl - control
 val - value
 opr - operator
FieldSearchCondition() Return extended filter condition
GroupByFieldNames() Return group by field names (separated by CrLf)
OrderByFieldNames() Return order by field names (separated by CrLf)
ParmFieldNames() Return drill down parameter field names (separated by CrLf)
JsValidator() Return JS validator for extended filter
JsValidatorCall(ctl) Return JS validator for extended filter based on parameter
Parms
 ctl - control
JsDefaultMsg() Return JS default error message for extended filter
PhpValidator() Return PHP (Server Side) validator for extended filter
PhpValidatorCommon(fld, msg) Return PHP (Server Side) validator for extended filter based on parameters
Parms
 fld - field name
 msg - error message
PhpDefaultMsg() Return PHP (Server Side) default error message for extended filter
RowFieldNames() Return row field names for crosstab report (separated by CrLf)
ColumnFieldNames() Return crosstab column field name
SummaryFieldNames() Return crosstab summary field name
CrosstabSql(sqlpart) Return crosstab SQL part
Parms
 sqlpart - SQL part token
SELECT, FROM, WHERE, GROUP BY, ORDER BY, SELECT AGGREGATE, GROUP BY AGGREGATE
CrosstabYearSql() Return crosstab SQL to get distinct year values
DistinctColumnSql(sqlpart) Return crosstab SQL part to get distinct column values
Parms
 sqlpart - SQL part token
SELECT
ReportSql(sqlpart) Return summary/list SQL part
Parms
 sqlpart - SQL part token
SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, SELECT AGGREGATE, AGGREGATE PREFIX
LookupSql(bDistinct, arFields, sFilter, sRunTimeFilterVar, bAddUserIDFilter, sSelectLimit, sDefaultOrderBy) Return codes for lookup SQL
Parms
 bDinstinct - use DISTINCT
 arFields - field array
 sFilter - filter SQL
 sRunTimeFilterVar - run time filter variable
 bAddUserIDFilter - add user id filter
 sSelectLimit - SELECT LIMIT
 sDefaultOrderBy - default order by
LookupSql1(bDistinct, arFields, sFilter, sRunTimeFilterVar, bAddUserIDFilter, sSelectLimit, sDefaultOrderBy) (v10+) Return codes for lookup SQL (part 1)
Parms
 bDinstinct - use DISTINCT
 arFields - field array
 sFilter - filter SQL
 sRunTimeFilterVar - run time filter variable
 bAddUserIDFilter - add user id filter
 sSelectLimit - SELECT LIMIT
 sDefaultOrderBy - default order by
LookupSql2(bDistinct, arFields, sFilter, sRunTimeFilterVar, bAddUserIDFilter, sSelectLimit, sDefaultOrderBy) Return codes for lookup SQL (part 2)
Parms
 bDinstinct - use DISTINCT
 arFields - field array
 sFilter - filter SQL
 sRunTimeFilterVar - run time filter variable
 bAddUserIDFilter - add user id filter
 sSelectLimit - SELECT LIMIT
 sDefaultOrderBy - default order by
SelectionList() Return selection list in JSON
ConnectionString(db) (v9.0+) Return database connection string
Parms
 db - database object
DatabaseConnection(db) (v9.0+) Return database connection array
Parms
 db - database object

 

 ©2007-2017 e.World Technology Ltd. All rights reserved.