Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts

Sunday, March 25, 2012

Adding/Previewing custom table style

Hi,

I need to add and preview custom table styles. I was able to add custom style by editing the StyleTemplates.xml file under "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Business Intelligence Wizards\Reports\Styles' as per one of the postings here.

Now, how should I add the ability for the user to preview this custom style. I can write a form similar to MS "Choose table style" proobably. Is there a way to launch a particular page of the report wizard programatically?

Thanks,

-Surendra

I have the same problem, Have you find the solution?

Adding/Previewing custom table style

Hi,

I need to add and preview custom table styles. I was able to add custom style by editing the StyleTemplates.xml file under "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Business Intelligence Wizards\Reports\Styles' as per one of the postings here.

Now, how should I add the ability for the user to preview this custom style. I can write a form similar to MS "Choose table style" proobably. Is there a way to launch a particular page of the report wizard programatically?

Thanks,

-Surendra

I have the same problem, Have you find the solution?

Sunday, March 11, 2012

adding root node in XML explicit query

I have sp called getLookupValue (using for xml explicit) that returns
multiple LookupType Node
<LookupType description="Claim Type">
<LookupValue lkvl_seq="10" lkvl_dsc="Accident" />
<LookupValue lkvl_seq="11" lkvl_dsc="Cancer" />
<LookupValue lkvl_seq="13" lkvl_dsc="Dental" />
</LookupType>
<LookupType description="File Source">
<LookupValue lkvl_seq="7" lkvl_dsc="AFLAC website" />
<LookupValue lkvl_seq="4" lkvl_dsc="Call" />
<LookupValue lkvl_seq="6" lkvl_dsc="Email" />
<LookupValue lkvl_seq="8" lkvl_dsc="Fax" />
<LookupValue lkvl_seq="5" lkvl_dsc="Letter" />
<LookupValue lkvl_seq="9" lkvl_dsc="Walk-in" />
</LookupType>
<LookupType description="File Type">
<LookupValue lkvl_seq="2" lkvl_dsc="CI" />
<LookupValue lkvl_seq="1" lkvl_dsc="EMF" />
<LookupValue lkvl_seq="3" lkvl_dsc="Media" />
</LookupType>
Can someone please let me know how can I modify the stored procedure to add
a root node.
Any sample code would help.
Thanks!
The easiest way to add a root node is to set the root node property on the
command object on the mid-tier.
SQL Server 2005 will have a ROOT() directive.
Best regards
Michael
"Manoj Agarwal" <ManojAgarwal@.discussions.microsoft.com> wrote in message
news:2DA49D31-E8B5-44DF-AF1A-30AC5DB72FC6@.microsoft.com...
>I have sp called getLookupValue (using for xml explicit) that returns
> multiple LookupType Node
>
> <LookupType description="Claim Type">
> <LookupValue lkvl_seq="10" lkvl_dsc="Accident" />
> <LookupValue lkvl_seq="11" lkvl_dsc="Cancer" />
> <LookupValue lkvl_seq="13" lkvl_dsc="Dental" />
> </LookupType>
> <LookupType description="File Source">
> <LookupValue lkvl_seq="7" lkvl_dsc="AFLAC website" />
> <LookupValue lkvl_seq="4" lkvl_dsc="Call" />
> <LookupValue lkvl_seq="6" lkvl_dsc="Email" />
> <LookupValue lkvl_seq="8" lkvl_dsc="Fax" />
> <LookupValue lkvl_seq="5" lkvl_dsc="Letter" />
> <LookupValue lkvl_seq="9" lkvl_dsc="Walk-in" />
> </LookupType>
> <LookupType description="File Type">
> <LookupValue lkvl_seq="2" lkvl_dsc="CI" />
> <LookupValue lkvl_seq="1" lkvl_dsc="EMF" />
> <LookupValue lkvl_seq="3" lkvl_dsc="Media" />
> </LookupType>
>
> Can someone please let me know how can I modify the stored procedure to
> add
> a root node.
> Any sample code would help.
> Thanks!
|||Hi Manoj,
look at this sample..hope this helps..dont worry about the length of the
code..look for what is needed.
output XML :
<products>
<product productID="" LastModifiedDate="">
<replacementPartList>
<replacementPart>
<partNumber></partNumber>
<name><![CDATA[]></name>
<erp></erp>
<revision></revision>
<version></version>
<environment> </environment>
<text><![CDATA[]]></text>
<conftext><![CDATA[]]></conftext>
</replacementPart>
<upgradeInfo><![CDATA[]]></upgradeInfo>
</replacementPartList>
<addOnPartList>
<addOnPart>
<name><![CDATA[]></name>
<erp></erp>
<revision></revision>
<version></version>
<environment> </environment>
<text><![CDATA[]]></text>
<conftext><![CDATA[]]></conftext>
</addOnPart>
<upgradeInfo><![CDATA[]]></upgradeInfo>
</addOnPartList>
</product>
</products>
Query :
SELECT
--product tag --
1 as tag
, NULL as parent
, NULL [products!1]
, NULL [product!2!productID]
, NULL [product!2!LastModifiedDate]
--replacementPart List --
--replacementPart List - add productID for Ordering. it needs to be
hidden. --
, NULL [replacementPartList!3!productID!hide]
--replacement Part--
, NULL [replacementPart!4!partNumber!element]
, NULL [replacementPart!4!name!element]
, NULL [replacementPart!4!erp!element]
, NULL [replacementPart!4!revision!element]
, NULL [replacementPart!4!version!element]
, NULL [replacementPart!4!environment!element]
, NULL [replacementPart!4!text!element]
, NULL [replacementPart!4!conftext!element]
--upgrade info--
, NULL [replacementPartList!3!upgradeInfo!element]
--AddOn Part List--
, NULL [addOnPartList!5!productID!hide]
--AddOn Part--
, NULL [addOnPart!6!partNumber!element]
, NULL [addOnPart!6!name!element]
, NULL [addOnPart!6!erp!element]
, NULL [addOnPart!6!revision!element]
, NULL [addOnPart!6!version!element]
, NULL [addOnPart!6!environment!element]
, NULL [addOnPart!6!text!element]
, NULL [addOnPart!6!conftext!element]
--upgrade info--
, NULL [addOnPartList!5!upgradeInfo!element]
UNION ALL
--Opening replacementPart List tag--
SELECT
--replacementPart List tag--
2 as tag
, 1 as parent
, NULL
, parts.ProductEditorialSKID
, ISNULL(Convert(Varchar(12),Max(parts.LastModifiedD ate),110),'')
--replacementPart List --
, NULL
--replacement Part--
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
--upgrade info--
, NULL
--AddOn Part List--
, NULL
--AddOn Part--
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
--upgrade info--
, NULL
FROM
#tblInfoWebParts parts
GROUP BY parts.ProductEditorialSKID
UNION ALL
--Opening replacementPart List tag--
SELECT
--replacementPart List tag--
3 as tag
, 2 as parent
, NULL
, parts.ProductEditorialSKID
, NULL
--replacementPart List --
, parts.ProductEditorialSKID
--replacement Part--
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
--upgrade info--
, (SELECT dbo.GetConcatenatedComments(parts.ProductEditorial SKID))
--AddOn Part List--
, NULL
--AddOn Part--
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
--upgrade info--
, NULL
FROM
#tblInfoWebParts parts
WHERE
parts.PartType <> 'A'
GROUP BY parts.ProductEditorialSKID
UNION ALL
--replacementPart--
SELECT
--replacementPart tag--
4 as tag
, 3 as parent
, NULL
, parts.ProductEditorialSKID
, NULL
--replacementPart List --
, parts.ProductEditorialSKID
--replacement Part--
, parts.PartNumber
, ISNULL(parts.ItemName,'')
, ISNULL(Convert(Varchar(10),parts.ERP),'')
, ISNULL(parts.RevisionName,'')
, ISNULL(parts.VersionName,'')
, ISNULL(parts.OperatingSystemName,'')
, ''
, ''
--upgrade info--
, NULL
--AddOn Part List--
, NULL
--AddOn Part--
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
--upgrade info--
, NULL
FROM
#tblInfoWebParts parts
WHERE
parts.PartType <> 'A' -- indicates that this part is a replacement part or
included part out of the bunch.
UNION ALL
--Add On Part List--
SELECT
--Add On Part List--
5 as tag
, 2 as parent
, NULL
, parts.ProductEditorialSKID
, NULL
--replacementPart List --
, NULL
--replacement Part--
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
--upgrade info--
, NULL
--AddOn Part List--
, parts.ProductEditorialSKID
--AddOn Part--
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
--upgrade info--
, (SELECT dbo.GetConcatenatedComments(parts.ProductEditorial SKID))
FROM
#tblInfoWebParts parts
WHERE
parts.PartType = 'A' -- indicates that this part is an add on part out of
the bunch.
GROUP BY parts.ProductEditorialSKID
UNION ALL
--Add On Part--
SELECT
--Add On Part--
6 as tag
, 5 as parent
, NULL
, parts.ProductEditorialSKID
, NULL
--replacementPart List --
, NULL
--replacement Part--
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
--upgrade info--
, NULL
--AddOn Part List--
, parts.ProductEditorialSKID
--AddOn Part--
, ISNULL(parts.PartNumber,'')
, ISNULL(parts.ItemName,'')
, ISNULL(Convert(Varchar(10),parts.ERP),'')
, ISNULL(parts.RevisionName,'')
, ISNULL(parts.VersionName,'')
, ISNULL(parts.OperatingSystemName,'')
, ''
, ''
--upgrade info--
, NULL
FROM
#tblInfoWebParts parts
WHERE
parts.PartType = 'A' -- indicates that this part is an Add On Part out of
the bunch.
ORDER BY [products!1]
, [product!2!productID]
, [replacementPartList!3!productID!hide]
, [replacementPart!4!partNumber!element]
, [addOnPartList!5!productID!hide]
, [addOnPart!6!name!element]
FOR XML EXPLICIT
Av.
http://avdotnet.rediffblogs.com
http://www28.brinkster.com/avdotnet
"Manoj Agarwal" <ManojAgarwal@.discussions.microsoft.com> wrote in message
news:2DA49D31-E8B5-44DF-AF1A-30AC5DB72FC6@.microsoft.com...
> I have sp called getLookupValue (using for xml explicit) that returns
> multiple LookupType Node
>
> <LookupType description="Claim Type">
> <LookupValue lkvl_seq="10" lkvl_dsc="Accident" />
> <LookupValue lkvl_seq="11" lkvl_dsc="Cancer" />
> <LookupValue lkvl_seq="13" lkvl_dsc="Dental" />
> </LookupType>
> <LookupType description="File Source">
> <LookupValue lkvl_seq="7" lkvl_dsc="AFLAC website" />
> <LookupValue lkvl_seq="4" lkvl_dsc="Call" />
> <LookupValue lkvl_seq="6" lkvl_dsc="Email" />
> <LookupValue lkvl_seq="8" lkvl_dsc="Fax" />
> <LookupValue lkvl_seq="5" lkvl_dsc="Letter" />
> <LookupValue lkvl_seq="9" lkvl_dsc="Walk-in" />
> </LookupType>
> <LookupType description="File Type">
> <LookupValue lkvl_seq="2" lkvl_dsc="CI" />
> <LookupValue lkvl_seq="1" lkvl_dsc="EMF" />
> <LookupValue lkvl_seq="3" lkvl_dsc="Media" />
> </LookupType>
>
> Can someone please let me know how can I modify the stored procedure to
add
> a root node.
> Any sample code would help.
> Thanks!

Sunday, February 12, 2012

Adding attributes to the root element.

Hi,
I am using the following caluse to generate xml ... For XML Path
('Vendor'), root ('vendors'), elements xsinil.
Which is good and working ... the result some what
<Vendors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Vendors ID='... > ...
..
</Vendors>
I would like to add more attributes to the root element 'Vendors'
1. xsd file --> xsi:noNamespaceSchemaLocation="VendorDetails.xsd"
2. Last query execution time -->
xml_generation_timestamp="2007-07-25 13:41:00.370" by using getdate()
3. custom attributes like Region="California"
Query looks like:
SELECT TOP 10 PERCENT
pv.VendorID AS '@.ID',
pv.AccountNumber AS '@.AccountNumber',
pv.Name,
pv.ActiveFlag AS 'Details/@.ActiveFlag',
pv.CreditRating AS 'Details/CreditRating',
pv.PreferredVendorStatus AS 'Details/PreferredVendorStatus'
FROM
PurchasingVendor pv
FOR XML PATH('Vendor'), root('Vendors'), elements xsinil
Please help ...
Thanks in advanceVankayala wrote:

> I am using the following caluse to generate xml ... For XML Path
> ('Vendor'), root ('vendors'), elements xsinil.
> Which is good and working ... the result some what
> <Vendors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <Vendors ID='... > ...
> ...
> </Vendors>
> I would like to add more attributes to the root element 'Vendors'
> 1. xsd file --> xsi:noNamespaceSchemaLocation="VendorDetails.xsd"
> 2. Last query execution time -->
> xml_generation_timestamp="2007-07-25 13:41:00.370" by using getdate()
> 3. custom attributes like Region="California"
>
> Query looks like:
> SELECT TOP 10 PERCENT
> pv.VendorID AS '@.ID',
> pv.AccountNumber AS '@.AccountNumber',
> pv.Name,
> pv.ActiveFlag AS 'Details/@.ActiveFlag',
> pv.CreditRating AS 'Details/CreditRating',
> pv.PreferredVendorStatus AS 'Details/PreferredVendorStatus'
> FROM
> PurchasingVendor pv
> FOR XML PATH('Vendor'), root('Vendors'), elements xsinil
One way to achieve that is by selecting the first query result into a
variable of type xml, then you can use the modify method to manipulate
the variable as needed, then you can select the variable:
DECLARE @.x xml;
SET @.x = (SELECT TOP 10 PERCENT
pv.VendorID AS '@.ID',
pv.AccountNumber AS '@.AccountNumber',
pv.Name,
pv.ActiveFlag AS 'Details/@.ActiveFlag',
pv.CreditRating AS 'Details/CreditRating',
pv.PreferredVendorStatus AS 'Details/PreferredVendorStatus'
FROM
PurchasingVendor pv
FOR XML PATH('Vendor'), root('Vendors'), elements xsinil, TYPE);
SET @.x.modify('
declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance";
insert attribute xsi:noNamespaceSchemaLocation {"VendorDetails.xsd"}
into (/*)[1]
');
-- add further attributes if needed
SELECT @.x;
Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/

Adding attributes to the root element.

Hi,
I am using the following caluse to generate xml ... For XML Path
('Vendor'), root ('vendors'), elements xsinil.
Which is good and working ... the result some what
<Vendors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Vendors ID='... > ...
...
</Vendors>
I would like to add more attributes to the root element 'Vendors'
1. xsd file --> xsi:noNamespaceSchemaLocation="VendorDetails.xsd"
2. Last query execution time -->
xml_generation_timestamp="2007-07-25 13:41:00.370" by using getdate()
3. custom attributes like Region="California"
Query looks like:
SELECT TOP 10 PERCENT
pv.VendorID AS '@.ID',
pv.AccountNumber AS '@.AccountNumber',
pv.Name,
pv.ActiveFlag AS 'Details/@.ActiveFlag',
pv.CreditRating AS 'Details/CreditRating',
pv.PreferredVendorStatus AS 'Details/PreferredVendorStatus'
FROM
PurchasingVendor pv
FOR XML PATH('Vendor'), root('Vendors'), elements xsinil
Please help ...
Thanks in advance
Vankayala wrote:

> I am using the following caluse to generate xml ... For XML Path
> ('Vendor'), root ('vendors'), elements xsinil.
> Which is good and working ... the result some what
> <Vendors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <Vendors ID='... > ...
> ...
> </Vendors>
> I would like to add more attributes to the root element 'Vendors'
> 1. xsd file --> xsi:noNamespaceSchemaLocation="VendorDetails.xsd"
> 2. Last query execution time -->
> xml_generation_timestamp="2007-07-25 13:41:00.370" by using getdate()
> 3. custom attributes like Region="California"
>
> Query looks like:
> SELECT TOP 10 PERCENT
> pv.VendorID AS '@.ID',
> pv.AccountNumber AS '@.AccountNumber',
> pv.Name,
> pv.ActiveFlag AS 'Details/@.ActiveFlag',
> pv.CreditRating AS 'Details/CreditRating',
> pv.PreferredVendorStatus AS 'Details/PreferredVendorStatus'
> FROM
> PurchasingVendor pv
> FOR XML PATH('Vendor'), root('Vendors'), elements xsinil
One way to achieve that is by selecting the first query result into a
variable of type xml, then you can use the modify method to manipulate
the variable as needed, then you can select the variable:
DECLARE @.x xml;
SET @.x = (SELECT TOP 10 PERCENT
pv.VendorID AS '@.ID',
pv.AccountNumber AS '@.AccountNumber',
pv.Name,
pv.ActiveFlag AS 'Details/@.ActiveFlag',
pv.CreditRating AS 'Details/CreditRating',
pv.PreferredVendorStatus AS 'Details/PreferredVendorStatus'
FROM
PurchasingVendor pv
FOR XML PATH('Vendor'), root('Vendors'), elements xsinil, TYPE);
SET @.x.modify('
declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance";
insert attribute xsi:noNamespaceSchemaLocation {"VendorDetails.xsd"}
into (/*)[1]
');
-- add further attributes if needed
SELECT @.x;

Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/

Thursday, February 9, 2012

Adding a XML schema to XML schema collection

I used SSEUtil to add a schema to my database but I am having problems.

Used these steps:
SSEUtil -c
> USE "c:\Rich.mdf"
> GO

>!RUN Resume.SQL
//indicates success
>SELECT * FROM SYS.XML_SCHEMA_COLLECTIONS
>GO
//schema not shown in list

> USE master
>GO
>SELECT * FROM SYS.XML_SCHEMA_COLLECTIONS
>GO
//schema is shown in the query

It appears that the schema is not added to the desired database, so when I try to use the schema in Visual Studio, the schema does not appear when I connect to the Rich.mdf database. Any ideas on what I am doing wrong or why this might be happening?

Thanks

Kevin

Really strange. Maybe there is some statement in the Resume.SQL that switch database to master when creating the schema?

|||Shouldn't, this is the script file:

CREATE XML SCHEMA COLLECTION ResumeXSD AS
N'<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" >
<xs:element name="Name" type="xs:string"></xs:element>
<xs:element name="Objective" type="xs:string"></xs:element>
<xs:element name="Address">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="Street" type="xs:string"/>
<xs:element name="City" type="xs:string"/>
<xs:element name="StateProv" type="xs:string" />
<xs:element name="Country" type="xs:string" />
<xs:element name="PostCode" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="WorkExperience">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="ExpText" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Reference">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="RefText" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>'
GO|||Well,

I accomplished my task of adding an XML Schema Collection. I logged into SSMSE and attached the database, then did a USE on the database, pasted SQL file into a new query and it worked.

I did notice after I got his working, that the book instructed me to do this:
CREATE XML SCHEMA COLLECTION ResumeXSD AS <snipped\
but in the sample it uses dbo:
CREATE XML SCHEMA COLLECTION dbo.ResumeXSD AS <snipped\
Maybe I'll try that later and see if it works.

-Kevin