DVPP (DataView Primary Property) keyword

Applies To

DataView form components

Most specifications

Description

This keyword returns a string containing the value of the named property within the primary collection (only) of the DataView that is related to the current row.  If the current row is a child, grandchild, or other non-primary row, the row in the primary collection that is the ancestor of the current row is used. If the property value is not found within the primary collection, an empty string is returned.

Syntax

DVPP ( dataViewName, propertyName )

Part Description
dataViewName Expression that evaluates to a string specifying the name of a DataView component.
propertyName Expression that evaluates to the name of a property referenced by the DataView component.

Remarks

The basic difference between this and the DVP (DataView Property) keyword is that the DVP keyword starts at the child level, if appropriate, and then, if the property value is not found there, it proceeds to search upwards through the ancestry of the child collection until it reaches the primary collection. This keyword (DVPP) does not deal with the child collections at all, but goes straight to the primary collection (top ancestor).

The reason to use this keyword (DVPP), rather than the DVP keyword, is to handle situations where the same property name exists on multiple levels of the DataView but means different things at each level. For example, in the case of Customer Orders and Customer Order Lines, both IDO collections might use the property name "Customer Number" for different properties: The Customer Number in the Customer Orders IDO is the customer who places the order. The Customer Number for the Customer Order Line IDO is the number used for drop shipping functionality. By using DVPP keyword, the Customer Number from the Customer Order IDO collection could always be used, even if the focus is on a Customer Order Line.

Example

This example shows how this keyword can be used in a WinStudio event handler with a response type of Set Values to set a variable value for a primary collection property from a DataView.

SETVARVALUES(MyVar=DVPP(dataView1, CustNum))

Rubriques liées