Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
programming4us
Windows 7

Microsoft Visio 2010 : Creating and Using Shape Data Fields (part 5) - Shape Data Labels versus Names

- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
3/13/2014 1:58:12 AM

6. Shape Data Labels versus Names

Shape Data fields actually have two names. Visio does its best to shield end users from this fact, but you will run into situations in which it helps to understand the nitpicky details.

Warning: This section is a bit technical, so you might choose to skip it or skim it quickly.

However, if you think Shape Data fields are the coolest, you plan on using them often in your Visio work, are interested in doing calculations with them, and want to link them to data using the Database Wizard, you need to understand how they are named.

Shape Data used to be known as Custom Properties until Visio 2007. You see vestiges of in the ShapeSheet, where you see that cells which hold Shape Data information are prefixed with “Prop.” If you search the Internet for information on Visio Shape Data, you will run into the term “Custom Properties” in older articles, and will probably find more information if you include the term in your search.

When you define a Shape Data field, note that you enter its name in a field called “Label.” If you turn on the Developer tab (via Customize the Ribbon), Visio switches to “developer mode” and adds extra elements to the user interface. In the Define Shape Data dialog, you see additional fields, one of which is the “Name” field.

Figure 6 compares the non-developer-mode dialog (left) with the developer-mode dialog (right).

Figure 6. The Developer-mode Define Shape Data dialog (right) shows more fields than the default. The ShapeSheet below shows the relationship between row Name and that of the Label.

In Figure 6, take a look at the Name field that appears just below Label. The Name is the row name of the Shape Data field, as represented in the ShapeSheet.

The ShapeSheet is how a developer views Visio shapes. It is an Excel-like spreadsheet that lives behind every Visio shape, “Developing Custom Visio Solutions.” Normally, you don’t need to go into the ShapeSheet, and you should probably stay away from it. But I’ve already warned you that this was a technical section, so have a glance at the ShapeSheet at the bottom of Figure 6.

Even though I’ve given the data fields nice names like “Power (Watts)” and “Bulb Type”, the fields are internally represented with dull automatic row names such as Prop.Row_1 and Prop.Row_3. You can see these row names in the developer version of the Define Shape Data dialog at right in Figure 6.

Visio tries to shield the average user from Row_1, Row_2, and Row_3 by showing only labels by default. However, if you try to map fields to a database using the (older) Database Wizard or try to do calculations with Shape Data fields, you run into them. This can make it hard to know what you’re mapping or calculating. If you have Visio 2010 Standard, the Database Wizard is your only data-linking option, so you’re even more likely to run into the problem.

Turning on the Developer tab on the Ribbon gives you a chance to change these names when defining Shape Data fields. For the light bulb shapes, you can change Row_1 to Power_W and Row_3 to Bulb_Type, for example. Note that row names can’t contain spaces, commas, colons, semicolons, and so on.

You don’t have to be a ShapeSheet developer to make use of this seemingly obscure knowledge. The insert field function lets you create calculations based on Shape Data fields using the Custom Formula option. To create custom formulas, you need to reference the row names, not the labels. And this feature is too cool to ignore, so let’s see how it works.

Creating a Simple Calculation Using Shape Data
1.
Continue working with Ch7 Shape Data.vsd.

2.
Turn on the Developer tab via Customizing the Ribbon.

3.
Copy a light bulb shape and clear the text from it. (I do it like this: Select the shape, type space, Backspace, Esc. No more text!)

4.
Bring up the Define Shape Data window for the shape.

5.
So that you can better understand where the power row is, change the row Name field from Row_1 to Power_W. Then click OK to accept the change.

6.
With the shape still selected, go to Insert, Field. The Insert Field dialog appears.

7.
Select Custom Formula from the Category list.

8.
In the Custom Formula field, type

= Prop.Power_W/1000 & “kW”

Notice that as you type Prop..., a drop-down list of Shape Data fields appears to assist you. Most of them still have “Row_” style names, but Prop.Power_W should be atop the list. The descriptive Shape Data labels are nowhere to be seen and you can see why changing row names is important.

9.
After you enter the complete formula, click OK. The shape’s text displays the kilowatts for the light bulb, calculated from the watts.

Prop.Power_W refers to the value stored in the Shape Data field. You then divide it by 1000 using the division symbol. Finally, you concatenate (append text) the units by using the “&” character and the letters kW.

10.
Change the Shape Data value of Power (Watts) to check that the text responds to data changes.

For the intrepid who would like a bit more control, there is a function that allows you to specify the formatting of calculations. To show two decimal units for the kilowatt value, you can enter the following formula:

FORMAT(Prop.Power_W/1000,“0.00”)&“kW”

Other -----------------
- Microsoft Visio 2010 : Working with Data - Introducing Shape Data Fields
- Advanced Windows 7 Programming : Working in the Background - DEVELOPING TRIGGER-START SERVICES (part 7)
- Advanced Windows 7 Programming : Working in the Background - DEVELOPING TRIGGER-START SERVICES (part 6)
- Advanced Windows 7 Programming : Working in the Background - DEVELOPING TRIGGER-START SERVICES (part 5)
- Advanced Windows 7 Programming : Working in the Background - DEVELOPING TRIGGER-START SERVICES (part 4)
- Advanced Windows 7 Programming : Working in the Background - DEVELOPING TRIGGER-START SERVICES (part 3)
- Advanced Windows 7 Programming : Working in the Background - DEVELOPING TRIGGER-START SERVICES (part 2)
- Advanced Windows 7 Programming : Working in the Background - DEVELOPING TRIGGER-START SERVICES (part 1)
- Advanced Windows 7 Programming : Working in the Background - ADVANTAGES OF WORKING IN THE BACKGROUND
- Microsoft Visio 2010 : Importing Graphics (part 6) - Importing AutoCAD Drawings - Manipulating an Imported AutoCAD Drawing and Adding Furniture
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 windows Phone 7 windows Phone 8
programming4us programming4us
 
programming4us
Natural Miscarriage
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Game Trailer