Scratch Element

Contains a work area for entering and testing formulas that are referred to by other elements. This element is typically used to isolate repeated complex calculations.

Syntax

<Scratch
    [IX]
    [Del]>
</Scratch>

Attributes

IX

Optional int. The zero-based index of the element within its parent element.

Del

Optional boolean. A flag indicating whether the element has been deleted locally. A value of 1 indicates that the element was deleted locally.

Element properties

Property

Value

Name

Scratch

Minimum Occurrences

0

Maximum Occurrences

Unbounded

Element information

Parent elements

PageSheet

Shape

StyleSheet

DocumentSheet

Child elements

X

Y

A

B

C

D

Elements contained in the Scratch element use units in two different ways. X and Y elements use drawing units; A , B , C , and D elements don't use units. (In C programmers' jargon, X and Y elements are "typed," and elements A through D are "void.") The X and Y elements are often used for deriving x- and y- coordinates, such as PinX and PinY (the X and Y elements found in a Geom element). Elements A through D can display whatever units you specify.

An additional difference is the way these elements store point values. A point in Microsoft Visio is a single data package for an ( x,y ) coordinate. When a formula returns a point value, that value is interpreted in one of three ways, depending on the element the formula is in. Elements that relate to x- coordinates (for example, PinX , or X elements of a Geom element) extract just the x- coordinate part of a point value. Elements that relate to y- coordinates extract just the y- coordinate part of a point value.

For example, Visio extracts the formula PNT(3,4) in these three ways.

Element

If you enter

Visio treats it as

Result

X

PNT(3,4)

PNTX(PNT(3,4))

3.0000 in.

Y

PNT(3,4)

PNTY(PNT(3,4))

4.0000 in.

A-D

PNT(3,4)

PNT(3,4)

PNT(3.0000 in., 4.0000 in.)

In DatadiagramML, the IX values start at 0. However, in the Visio ShapeSheet user interface, row numbers start at 1. Therefore, row 1 in a ShapeSheet window is equivalent to IX='0' in the XML.

The Scratch element is relevant only when contained in a DocumentSheet, PageSheet, or Shape element. It is ignored when contained in a StyleSheet element.

See also

Scratch section