DVP (DataView Property) keyword

Applies To

DataView form components

Most specifications

Description

This keyword returns a string containing the value of the named property within the currently selected row of a named DataView component. If the property is not found and the current row has a parent row, the parent row is checked for the property value. If the property value is not found there either, an empty string is returned.

Syntax

DVP ( 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 DVPP (DataView Primary Property) keyword is that this keyword (DVP) 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 the (DVPP) keyword, 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. If this keyword is used, the DataView component uses the first property with the specified name, which in this case, would be from the Customer Order Lines IDO collection.

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 from a DataView.

SETVARVALUES(MyVar=DVP(dataView1, CustNum))