all groups > sql server notification services > september 2004 >
You're in the

sql server notification services

group:

1 event 2 notification formats


1 event 2 notification formats lhomes
9/29/2004 10:00:57 AM
sql server notification services:
I need to be able to send 2 different formats of email
when an event happens. 1 internal that has a bunch of
data about the details of the event and the other
external with just a simple notification - no details. I
can make this work with different device types but it
seems like there should be a better way.

Is there a way to select the format through the
subscription? ie I want to subscribe to event 1 in format
1 and user 2 wants to subscribe to the same event but
receive format 2 (both formats are sent via email)????

I'm having a hard time getting a handle on all the
various relationships between events, subscriptions,
devices, subscribers, event rules, notifications,
formatting, protocols and channels. Is there somewhere
where there is a diagram showing the relationships of the
items in the appadf and appconfig files and the object
model of the subscription management objects?

I've defined
1 event class
1 subscription class
- 2 event rules
-- 1 creates notifications1 by including device 1
-- 2 creates notifications2 by including device 2
2 notification classes
--1 xslt formatter which produces detail
--2 xslt formatter produces reduced

1 user subscribes with device 1 to event 1 gets detail
1 user subscribes with device 2 to event 1 gets reduced
info

since the content formatting appears to be tied to the
notification class, I basically had to duplicate the
notification class, change the name, change the xslt
file , create the new xslt file, and add a second event
rule to hard code to include in ints selection criteria
where the subscription device is the second device. Then
define another delivery channel, and device, and change
subscriptions for some users to use the second device
(emailReduced) and some to use the original. I've
basically copied and pasted a bunch of stuff and made it
harder to maintain when all I wanted was 2 formats for 1
event for the same delivery mechanism (email).

- any direction appreciated.

has anybody seen any microsoft blogs related to sql
notification services?

Re: 1 event 2 notification formats lhomes
9/30/2004 6:02:44 AM
Thank you for replying. Is there some other way than
creating 2 seperate device types? They are both a
standard email inbox. Or is that the primary use of
device type to control formatting?

-lhomes



[quoted text, click to view]
Re: 1 event 2 notification formats avnrao
9/30/2004 4:44:05 PM

[quoted text, click to view]

Re: 1 event 2 notification formats avnrao
9/30/2004 4:46:06 PM
here is what u can do.
create a custom formatter that finds the device type of the subscriber uses
XSLTransform and picks up the correct XSLT file.

in this case you can have one notification class - but you need 2 XSLT
files.

hth,
Av.

[quoted text, click to view]

Re: 1 event 2 notification formats Colin Meek [MSFT]
10/1/2004 8:09:43 AM
The XSLT transform file is chosen according to the criteria outlined in the
BOL article "XSLT File Location". The device type can as you suggest be used
to control which formatting will apply to a subscription. You do not however
need to include two notification classes and event rules. You can define the
device name in the subscription, and set the device name in the notification
through the <Action>, e.g.:

<Action>
SELECT NewsNotificationNotify(S.SubscriberId, S.SubscriberDeviceName,
S.SubscriberLocale, E.Headline, E.BrowseBackURL)
FROM NewsSubscribers S JOIN NewsEvents E
ON S.SiteName = E.SiteName
</Action>

Let me know if this is what you were after!

-Colin Meek [MSFT]

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
--

[quoted text, click to view]

Re: 1 event 2 notification formats lhomes
11/1/2004 9:34:25 AM
So in that case, my xslt file would need to determine how
to format based on the device type?

[quoted text, click to view]
Re: 1 event 2 notification formats Colin Meek [MSFT]
11/3/2004 8:02:52 AM
You can actually instruct NS to use different XSLT files for different
devices. The XSLT itself doesn't need to have conditional behavior. Here is
the full text of the article I mentioned:

XSLT File Location
Information about the subscriber locale and device type of the recipient is
supplied to the content formatter as part of the notification data. The
subscriber locale is identified using the set of locale strings that are
shipped with Notification Services. The device type is identified using the
set of devices supported by the application, as specified by the developer.

These values are not directly available to you to use in the XSLT file.
Notification Services uses them to select from among the XSLT files that you
provide, based on the XSLT file location.

The base directory that you specify in the application definition file (ADF)
is the root directory under which your XSLT files are found. The XSLT file
can reside in a subdirectory of the base directory, to allow for specific
transforms based on locale and device type.

Notification Services expects to find one subdirectory under the base
directory for each combination of locale and device type that is to have a
specific transformation. These directories should follow this format:

XSLTBaseDirectory\SubscriberLocale\DeviceType
The subscriber locale and device type elements are optional.

Example
In the following example, you want to provide transformations for the
combinations shown in the following table.

Recipient information XSLT path
French, Canada, all device types BaseDirectory\fr-CA\transform.xsl
English, Canada, all device types BaseDirectory\en-CA\transform.xsl
English, United States, cellular phones
BaseDirectory\en-US\CellularPhoneDeviceTypeName\transform.xsl
English, United States, all other device types
BaseDirectory\en-US\transform.xsl

The content formatter searches for an XSLT file that matches the locale and
device type information of the notification it is processing, going from the
most specific match to the least specific match. The search process looks
for matching directories in the following order:

a.. XSLTBaseDirectory\SubscriberLocale\DeviceType
b.. XSLTBaseDirectory\SubscriberLocale
c.. XSLTBaseDirectory\DeviceType
d.. XSLTBaseDirectory
-Colin Meek [MSFT]

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
--

[quoted text, click to view]
Re: 1 event 2 notification formats Shyam Pather [MSFT]
11/4/2004 10:32:28 AM
No, you would have 2 different XSLTs, one for each device type. As long as
you place them in the appropriate directories (see the article Colin
references) NS will pick up one or the other, depending on the device type
specified for the notification.
-shyam

--
Learn more about SQL-NS:
http://www.amazon.com/exec/obidos/tg/detail/-/0672326647/
---------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
---------------------------------------------
[quoted text, click to view]

AddThis Social Bookmark Button