Object-Oriented Interface

rptcalcfield

 

The rptcalcfield object is a data member of the pvxreport object interface that is delegated to store and manipulate a calculated field definition. It can be used to retrieve the object handle for an rptcalcfield object, which allows access to all the object's methods and properties.

rptcalcfield Properties

The following table lists the properties of the rptcalcfield object:

Property

Description

DataSource$

Reference for the data source that is associated with this calculated field. Format is Source, SourceType.

Examples:

   LogicalFileName,L 
   Path,P
   ViewName,V 
   SourceClass;SourceName,O

This property is only used in report libraries. Read only. Set using SetDataSource( ) method.

Description$

(Optional) Short description for the field.

Expression$

Expression to be evaluated and loaded into the variable specified in Name$. Read only property. Loaded using the SetExpression( ) method.

Length

Maximum length of the field. Numeric fields may contain a scaling factor (e.g. 10.2 where 10 is the total length and 2 is the number of digits following the decimal point).

Library$

Name of the library file containing the definition for this calculated field. Can be a simple file name or complete path. Read only. Set using SetLibrary( ) method.

Name$

Variable name for the calculated field.

Type$

Data type: N (numeric) or S (string). Set when expression is loaded using SetExpression( ) or SetTranslationValue( ) methods.

rptcalcfield Methods

The following table lists the methods of the rptcalcfield object:

Method

Description

AddTranslationValue([idx])

Create a new rptfilterctl object to hold the condition to be associated with the translation value. One object is created for each translation value. Also allocates storage for the translation value and an expression indicator.

idx - If omitted or set to zero, the rptfilterctl object is created using the next available sequence number. If set, the object is inserted at the sequence number indicated by idx.

The sequence number can be used as the index number to identify the object when using other methods relating to translation fields, such as GetTranslationCondition( ), GetTranslationValue$( ), etc.

TranslationValueCount is incremented. Returns the object handle if successful, 0 if not.

ClearTranslationValues( )

Removes all translation values, expression indicators, and rptfilterctl objects associated with the translation values.

GetTranslationCondition(idx)

Returns the object ID for the specified rptfilterctl object.

idx - Sequence number of the object.

Returns 0 if the sequence number is invalid.

GetTranslationValue$(idx)

Returns the specified translation value. May be a fixed value or an expression. Refer to the IsTranslationValueExpression( ) method below to determine the content type.

idx - Sequence number of the translation value. Returns null if the sequence number is invalid.

IsTranslationValueExpression(idx)

Returns a Boolean value (0 or 1) indicating whether the specified translation value contains an expression (1) or a fixed value (0).

idx - Sequence number of the translation value.

MoveTranslationValue(Fromidx,Toidx)

Changes the sequence of a translation value (i.e. value, expression indicator and rptfilterctl object sequence). The sequence of other translation values is appropriately adjusted.

Fromidx - Sequence number of translation value to be moved.

Toidx - Sequence number to move translation value to.

RemoveTranslationValue(idx)

Removes the rptfilterctl object and clears the translation value and expression indicator for the specified translation value.

idx - Sequence number of the translation value to be removed. Translation values with higher sequence numbers are adjusted down.

TranslationValueCount is decremented.

SetDatasource(Source$,Type$)

SetDatasource( )

Format and set the value in the DataSource$ property.

Source$ - Name of the data source. This can be a logical table name, a file path, a view or a class name;source name. (Custom source objects consist of both the class name and source name separated by a semi-colon.)

Type$ - Single letter code denoting type of data source:

   L - Logical table
   P - File path
   V - View
   O - Custom source class

Returns 1 if successful, 0 if not. If not arguments, resets the DataSource$ property to null.

SetExpression(Expr$)

Set the expression to be evaluated and loaded into the variable specified in the Name$ property.

Returns 1 if successful and 0 if the expression is invalid.

SetLibrary(LibraryFile$)

Sets the name of the library file containing the definition for this calculated field specified in LibraryFile$. Can be a simple file name or complete path. Returns 1 if successful, 0 if not.

SetTranslationValue(idx,Value$[,isExpression$[,Type$]]

Sets the translation value at the specified sequence number. 

idx - Sequence number of the translation value to be set.

Value$
- Translation value. May be fixed or an expression.

isExpression$ - "X" denotes that value$ contains an expression. "F" or null ("") denotes that value$ contains a literal or fixed value. (Optional) Default is a fixed value.

Type$ - "S" (string) or "N" (numeric). If the Type$ property of the rptcalcfield class has already been set, then this value is ignored. If it has not been set, then this value is used to set it.

TranslationValueCount( )

Returns the number of translation values associated with a translation field.