Professional InfoPath 2003 [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Professional InfoPath 2003 [Electronic resources] - نسخه متنی

Ian Williams, Pierre Greborio

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید











Other Controls


InfoPath provides additional controls that don’t directly correspond to editing components, though they can make use of them. Here, we briefly describe two of the more interesting controls, Hyperlink and Expression Box.


Hyperlinks


InfoPath allows users to insert a hyperlink into any rich text field. If the field doesn’t support rich text, the menu item is disabled. In design mode you can also place a link anywhere on a form. For example, you might want to link your users to a Web site containing procedural instructions for the relevant part of a business process. In both cases, InfoPath will automatically recognize URLs, filenames, and e-mail addresses and format them as links.

Design mode additionally provides a hyperlink control that you can drag onto the form. You can specify a static URL or point to a data source element or attribute containing the URL you want the link to use. You can also specify a separate text for the link object either statically or again using the form data source.

In this example the link takes the value of a data source:


<div> Follow this <a xd:disableEditing="yes">
<xsl:attribute name="href">
<xsl:value-of select="procedure/@url"/>
</xsl:attribute>link</a> for assistance with this procedure.
</div>

In the case study Contributor view, there’s a link from a persistent form image of an e-mail icon. The icon is a hyperlink to a news desk e-mail address in the form header. Figure 8-8 shows the interface control.


Figure 8-8: The user interface for the e-mail link.


<a
title="Launch Outlook to email the desk" tabIndex="9"
xd:disableEditing="yes">
<xsl:attribute name="href">
<xsl:value-of select="concat(&quot;mailto:&quot;,
../formHeader/@email, &quot;?subject=&quot;, title)"/>
</xsl:attribute>
<img title="Email the desk" style="BORDER-RIGHT: #0000ff 1.5pt;
BORDER-TOP: #0000ff 1.5pt; BORDER-LEFT: #0000ff 1.5pt; WIDTH: 24px;
BORDER-BOTTOM: #0000ff 1.5pt; HEIGHT: 24px" height="24" src="EDB78201.png"
width="24"/>@@@AU: Please break lines where appropriate (i.e., no wrap
</a>

One other attractive feature of hyperlinks is that you can use XPath to build values using the same techniques as expression box controls. For example, you might want to take a base URL and add to it the local name that identified a given file:


concat(baseurl,’/’date,’/’,formheadr/@deskID,’/’,identifier,’l’)

This would give a link value such as [http://newsline.net/20031103/ny0522l].

We can hear your mind ticking. There’s more to come next.


Expression Boxes


You can use expression boxes to add, subtract, multiply, and divide numeric values, as well as perform other calculations. The values used are relative XPath expressions to the XML nodes containing the information. So an example might be


payment/dollarValue div exchangeRate

The following table gives the expression syntax for each function.






















Function


Expression


Add two fields


field1 + field2


Subtract a field from another


field1 - field2


Multiply two fields


field1 * field2


Divide a field by another


field1 div field2


With repeating fields or parts of a repeating group, you can perform counts sums and averages on columns of figures, for example:


count(meta/subjects/subject)

Or you can write out a row number next to a row in a repeating table with a simple position() statement:


position()

The form layout in Figure 8-9 shows the use of position in a repeating table. The Order Item column contains an expression box using the position function, and a total of the order values below the Value column is calculated using the sum function. Before you start filling in the form, the total expression box shows 1.#QNAN (meaning “not a number”). To avoid this, either provide a default value for the field or filter the blanks in the empty field by using a pattern in your xPath expression.


sum(orders/value[.!="])


Figure 8-9: The empty form control.

As you fill out the form, the order items are numbered and the total builds. See Figure 8-10.


Figure 8-10: The filled-out control.

With text fields you can concatenate values using the concat expression, as you saw in the section on hyperlinks:


concat(formHeader/@deskID,’ ‘,formHeader/@email)

This is just like the expressions you are familiar with if you’ve used XSLT. It’s worth experimenting here, as you can create dynamic values very readily. Just remember that you aren’t creating data that is bound to a data source and, therefore, to an element or attribute. If you want to preserve the results, you’ll have to use a script to assign the value you’ve created.

Have fun!

/ 166