Subordinate Objects

ViewDef

 

ViewDef is a subordinate object used to define a basic view definition. It creates a group of CalcItem objects to manage information concerning calculated items that have been defined for the view, as well as a group of ViewItem objects to manage information concerning items selected for the view. A ViewDef object corresponds to a record in the pvxview.src file.

For information on the pvxview.src file structure, see Views System File Structures.

ViewDef Properties

The following table lists the properties of the ViewDef subordinate object:

Property

Description

CloseLogic$

Logic to be executed when a view is closed using the 'Close() method. See Logic Procedures.

CloseLogicType$

Same as for InitLogicType$.

Description$

Short description used to identify the view.

Filter$

Free-form data filter.

InitLogic$

Logic to be executed when a view is opened using the 'Open() method. Reference based on InitLogicType$.

If type C, InitLogic$ contains program;entrypoint.

If X, InitLogic$ contains PxPlus statement(s) to be executed. String, 128 characters. See Logic Procedures.

InitLogicType$

Single character string indicating logic type:

C

Call

X

Execute

I or null

Ignore (Default)

InternalID$

Internal identifier for the view.

Key$

Sort key for reading the primary data source.

Locked

Indicates that the view definition cannot be modified unless unlocked with password.

1

Locked

0

Not locked

LogicObject$

Object specified to supply logic references. See Logic Procedures.

LongDescription$

Long description for storing notes about the view.

Order$

Element order:

A

Alphabetic

" " null

Natural order (Default)

OriginalDescription$

(Internal Use Only)

Original description of the view when loaded.

Password$

Encrypted password for locking view definition.

PrimarySource

DataSource object identifier for primary data source.

UpdateStamp$

Last update.

ViewDefMethods

The following table lists the methods of the ViewDef subordinate object:

Method

Description

AddCalcItem( )

Add a new CalcItem object to the view.

(AddCalcItem method was added in PxPlus 2021.)

AddItem(ItemPath$)

(Internal Use Only)

Add a new ViewItem object to the view based on the item path. The sequence of the ViewItem objects will be adjusted automatically to ensure they are grouped by their linkage path. Use ViewCtl equivalent.

AdjustItemSequence( )

Adjust the sequence of the ViewItem objects based on their linkage path.

Clear( )

Re-initialize the view definition and delete all CalcItem and ViewItem objects created by it.

ClearCalcItems( )

Delete all CalcItem objects belonging to the view.

(ClearCalcItems method was added in PxPlus 2021.)

ClearItems( )

Delete all ViewItem objects belonging to the view.

GetCalcItem(ItemPath$ | Column$ | idx)

Return the object identifier for the specified CalcItem. (No trailing "$" when specifying a column.)

(GetCalcItem method was added in PxPlus 2021.)

GetCalcItemCount( )

Return the number of CalcItem entries.

(GetCalcItemCount method was added in PxPlus 2021.)

GetCalcItemIndex(ItemPath$ | Column$)

Return the specified CalcItem group index. (No trailing "$" when specifying a column.)

(GetCalcItemIndex method was added in PxPlus 2021.)

GetItem(ItemPath$ | Column$ | idx)

Return the object identifier for the specified ViewItem. (No trailing "$" when specifying a column.)

GetItemCount( )

Return the number of ViewItem entries.

GetItemIndex(ItemPath$ | Column$)

Return the specified ViewItem group index. (No trailing "$" when specifying a column.)

LoadPassword(Password$)

(Internal Use Only)

Load an encrypted password. View must be unlocked with no current password.

RemoveCalcItem(ItemPath$ | idx)

Remove a calculated item from the view.

(RemoveCalcItem method was added in PxPlus 2021.)

RemoveItem(ItemPath$ | idx)

(Internal Use Only)

Remove an item from the view. Use ViewCtl equivalent.

SetCondition(ItmPath$, Code, Case[, v1$ v8$])
SetCondition(Column$, Code, Case [, v1$..v8$])

Set a filter condition at the view item level.

ItmPath$/Column$ (No trailing "$"): Used to identify item.

Code - Condition indicator code:

1

Equal to <Value1>

2

Not equal to <Value1>

3

Less than <Value1>

4

Greater than <Value1>

5

Less than or equal to <Value1>

6

Greater than or equal to <Value1>

7

Between <Value1> and <Value2> inclusive

8

Between <Value1> and <Value2> exclusive

9

Any of <Value1>,<Value1>, …<Value1>

10

None of <Value1>,<Value1>, …<Value1>

11

Contains <Value1>

12

Starts with <Value1>

Case - Case sensitivity indicator:

 

0

Not case sensitive

 

1

Case sensitive

 

v1$...v8$ - Values to be used in comparison. Pass numeric values as string arguments.

Note:
View item-level filters are analyzed at run time to optimize data retrieval by determining key ranges for reading records.

SetCloseLogic(Type$,Logic$)

Set CloseLogic$.

SetDescription(Description$)

(Internal Use Only)

Set the description of the view. Use ViewCtl equivalent.

SetFilter(Condition$)

(Internal Use Only)

Set the filter to be applied at the view level.

Condition$

A free-form PxPlus expression that can be evaluated as true (1) or false (0). Variables used in the condition must be the column names assigned to the view items. The condition may be a simple condition or a complex condition using AND and OR logical operators.

Example:

CustType$(2,1)="C" OR CustBalance>1000

Note:
View-level filters are not analyzed at run time to optimize data retrieval by determining key ranges for reading records. If the filter you are setting could be used for optimization purposes, see if you can set a similar condition at the view item level, using the SetCondition( ) method.

Use ViewCtl equivalent.

SetInitLogic(SrcObjID, Type$, Logic$)

Set initialization logic for a ViewDef or DataSource object.

SetInitLogic(Type$, Logic$)

Set InitLogic$.

SetInternalID(InternalID$)

(Internal Use Only)

Set the internal identifier for the view.

SetKey(Key$)

Set the sort key for reading the primary data source.

Key$ - Key number (0-based for primary key).

SetLogicObject(ObjNm$)

Set LogicObject$.

SetLongDescription(LongDescription$)

Set the long description for storing notes about the view.

SetOrder(Order$)

Set the element order:

A

Alphabetic

" " null

Natural order (Default)

SetOriginalDescription$(Description$)

(Internal Use Only)

Set the original description when view is loaded.

SetPassword(Password$)

Put a password on an unlocked view definition. Remove the password by passing a null password.

SetPrimarySource(ObjID)

(Internal Use Only)

Set the object identifier of the primary DataSource object.

SetUpdateStamp(Stamp$)

(Internal Use Only)

Set the date/time stamp for the last update.

Unlock(Password$)

Unlock a passworded view definition for update, but do not remove the password.

ItmPath$ - [Link ObjID [+ Link ObjID …]] + DS_Item ObjID

The path begins just below the primary data source, resulting in the path for items from the primary data source consisting of the DS_ItemObjID alone.