The SLX_Common script included in SalesLogix contains a number of simple, yet useful, functions that you can use within your own functionality to save yourself some time by not having to reinvent the wheel each time you need some simple functionality.
- GetItemIndex(Control, Value)
- This function returns the index for an item within a control such as a ComboBox, CheckListBox, ListView, ect. Basically, any control with an "Items" property.
- SLXIsNumeric(Value), NulltoZero(Value), CheckForNull(Value), CheckForNullDate(Value)
- This series of functions can be used to evaluate a number of different datatype for null or blank values.
There are a number of functions to provide some basic calulations commonly performed against currency values:
- CalculateAdjustedPrice(Price, Discount)
- CalculateDiscountPercentage(AdjustedPrice, PriceBase)
- CalculateExtendedPrice(AdjustedPrice, ExchangeRate)
- CalculateLocalPrice(AdjustedPrice, ExchangeRate)
- CalculateExtendedPriceLocal(Quantity, PriceLocal)
- ExtendedPriceTotal will total up all records from the passed recordset, where the fieldname is "Extended")
There are also a couple of scripts to help with SQL statements:
- GetSQLConditionClause(Index, strFltText), GetSLXConditionClauseEx(Index, strFltText, strField)
- The Index number passed corresponds with the type of query to run... (0 = Like with wildcards, 1 = Like, 2 = Equals To, 3 = Not Equal To, etc...)
- AddToWhereClause(Field, Clause, Where), AddToWhereClauseEx(Field, Clause, Where, Condition)
- AddCommaDelimatedTextToWhereClause(intCauseIndex, strWhere, strText, strField)
This is just a short list of some of the functionality available in this particular script. Other useful functionality is available in this, as well as many other scripts which are included within SalesLogix. In addition, if you're relatively new to VB scripting, these scripts provide some invaluable examples for how Subroutines and Functions can be built within the SalesLogix client.