Library – Utility Procedures

The test library includes a codeunit named Library – Utility: Codeunit 131000. This documentation lists the functions, their parameters and return values. This list should provide some information useful for creating test functions. Only the code can provide the full description of each function, but this reference should be sufficient for most uses.

CreateNoSeries

Paramters

VAR NoSeries: Record 308
Default: Boolean;
Manua : Boolean;
DateOrder: Boolean

Create a random number for a new number series and insert it into the No Series table.

CreateNoSeriesLine

Parameters:

VAR NoSeriesLine: Record 309;
SeriesCode: Code[10];
StartingNo : Code[20];
EndingNo: Code[20]);

Creates the NoSeriesLine to go with above NoSeries, passed in via the VAR NoSeriesLine parameter.

CreateNoSeriesRelationship

Parameters:

Code: Code[10];
SeriesCode: Code[10]

Add row to the CreateNoSeriesRelationship record.

CheckFieldExistenceInTable

Parameters:

TableNo: Integer
FieldName: Text[30]

Return Value:

Boolean

Checks for the existence of a field in a table, not the content. Returns a “true” if the field exists by name.

CompareTwoRecords

Parameters:

RecRef1 : RecordRef;
RecRef2: RecordRef;
FieldCountsToBeIgnored: Integer;
DiscardDateTimeFields: Boolean;
VAR FieldNumbersNotMatched: ARRAY [200] OF Integer;
VAR Value1: ARRAY [200] OF Variant;
VAR Value2: ARRAY [200] OF Variant;
VAR MismatchCount: Integer

Return Value:

Boolean;

Two records, represented by RecRef1 and RecRef2, are compared, field by field, value by value.

FieldCountsToBeIgnored represents a number of fields that can be unmatched and still consider the rows to be the same.

DiscardDateTimeFields ignores all date, time, and datetime types.

Value1 and Value2 arrays return mismatched values by field sequence. Array index may not be a match for the record if date/time fields are ignored.

ConvertMilliSecToHours

Parameters:

TimePeriod: Decimal

Returns:

Decimal

ConvertHoursToMilliSec

Parameters:

TimePeriod: Decimal

Return Value:

Decimal

ConvertNumericToText

Parameter:

NumericCode: Text

Return Value:

Text

FindControl

Parameters:

ObjectNo: Integer
FieldNo: Integer

Return Value:

Boolean

Finds a control on a page by name, given the object number of the page. Returns true if the control is found.

FindEditable

Parameters:

ObjectNo: Integer

FieldNo: Integer

Return Value:

Boolean

Find and return the Editable property for a page control. Generate an error if page control does not exists.

FindFieldNoInTable

Parameters:

TableNo: Integer
FieldName: Text[30]

Returns:

Integer

Returns the field no of a field by name in a table. Generates an error if the field not found.

FindMaxValueForField

Parameters:

ObjectNo: Integer
FieldNo: Integer

Return Value:

MaximumValue : Integer

Returns a maximum value of a field in a table. Irrelevant if not a numeric field

FindMinValueForField

Parameters:

ObjectNo: Integer
FieldNo
: Integer

Return Value:

MinimumValue : Integer

Find the minimum value possible for a field.

FindVisible

Parameters:

ObjectNo: Integer
FieldNo: Integer

Return Value:

Boolean

Returns whether a control on a page is visible on the page.

GetFieldLength

Parameters:

TableNo : Integer
FieldNo : Integer

Returns:

Integer

GetLastTransactionNo()

Returns:

Integer

Returns the EntryNo from the last G/L transaction.

GetNewRecNo

Parameters:

RecVariant : Variant
FieldNo : Integer

Returns :

Integer

GetNewLineNo

Parameters:

RecRef : RecordRef
FieldNo : Integer

Returns:

Integer

Find the value of Line No. for a new line in the Record passed as Record Ref.
1. It is assumed that the field passed is part of the primary key.
2. It is assumed that all the primary key fields except Line No. field are already validated on the record.

GetGlobalNoSeriesCode()

Return Value:

Code[10]

Init, get the global no series

GetNextNoSeriesSalesDate

Paramters:

NoSeriesCode : Code[10])

Return Value:

Date

GetNextNoSeriesPurchaseDate

Parameters:

NoSeriesCode : Code[10])

Return Value:

Date

LOCAL GetPropertyValue

Parameters:

ObjectType : Option
ObjectNo : Integer
FieldNo : Integer
PropertyName : Text[30]
SuppressError : Boolean

Return Value:

Text[30]

Given an object type and number, and a field no and property name (text), returns the text value of the property.

GetPropertyValueForControl

Parameters:

ObjectNo : Integer
FieldNo : Integer
PropertyName : Text[30
SuppressError : Boolean

Return Value:

Text[30]

GetPropertyValueForField

Parameters:

ObjectNo : Integer
FieldNo : Integer
PropertyName : Text[30]
SuppressError : Boolean

Return Value:

Text[30]

GenerateRandomCode

Parameters:

FieldNo : Integer
TableNo : Integer
Return Value:

Code[10]

Create a random and unique code for the any code field.

GenerateRandomText

Parameter:

Length : Integer

Return Value:

String : Text

GenerateRandomXMLText

Parameters:

Length : Integer

Return Value:

String : Text

GenerateRandomAlphabeticText

Paramters:

Length : Integer
Option : ‘Capitalized,Literal’

Return Value:

String : Text

GenerateRandomFraction()

Return Value:

Decimal

GenerateRandomDate

Parameters:

MinDate : Date
MaxDate : Date

Return Value:

Date

GenerateGUID()

Return Value:

Code[10]

GenerateMOD97CompliantCode()

Return Value:

CodeMod97Compliant : Code[10]

ExistsDecimalValueInArray

Parameters

RowValueSet : ARRAY [250] OF Text[250]
Value : Decimal

Return Value:

Boolean

FindRecord

Parameter:

VAR RecRef : RecordRef

LOCAL GetTextValue

Parameter:

ObjectType : Option

Return Value:

Text[30]

LineBreak()

Return Value:

Text

A return character as text

FindOrCreateCodeRecord

Parameter:

TableID : Integer

Return Value:

Code[10]

CreateCodeRecord

Parameter:

TableID : Integer

Return Value:

Code[10]

UpdateSetupNoSeriesCode

Parameters:

TableID : Integer
FieldID : Integer

GetMaxOptionIndex

Parameter:

OptionString : Text

Return Value:

Integer

GetMaxFieldOptionIndex

Parameters:

TableNo : Integer
FieldNo : Integer

Return Value:

Integer

Returns the number of option values for a field. If not an OPTION type, returns an error.

FillMaxText

Parameter:

RecVar : Variant
FieldNo : Integer

Fills a field with the largest text field possible.