Reply
 
LinkBack Thread Tools Display Modes
Old 04-30-2011, 01:52 PM   #1 (permalink)
Member
 
Join Date: Apr 2011
Posts: 32
engcosta is on a distinguished road
Default i need to hide video and its price and add it to screen zone

i have 2 diffrent zones video and screens and i don't need video to appear and to add its price to screen price how i can do that ??

that is what appear to me i need to hide video and its price and add it to screen zone
engcosta is offline   Reply With Quote
Old 05-02-2011, 07:57 AM   #2 (permalink)
Senior Member
 
Join Date: May 2009
Location: Chennai, India
Posts: 157
nkarthick is on a distinguished road
Default Try updated script

Hi,

I already gave you the script for Zone Summary here.
For now i have UPDATED the same script to remove 'Video' zone and include prices of 'Video' into 'Screens'.

Here we go -
Code:
Imports System.Xml
Imports DTools.SystemIntegrator.Reporting
Imports System.Collections.Generic

Private ds As DataDynamics.ActiveReports.Datasources.XMLDatasource = Nothing
Private doc As XmlDocument 
Private xmlRoot As XmlElement
Private xmlns  As XmlNamespaceManager = Nothing

Sub ActiveReport_ReportStart

try

SortItemsByZone()

catch
'Ignore
End try

End Sub

Sub SortItemsByZone()

ds = rpt.DataSource
doc = ds.Document
xmlRoot = doc.DocumentElement


xmlns =  ReportingNamespaceUtility.ReturnXMLNamespaceManager(doc.NameTable)

Dim xmlItemsRootNode As XmlNode = xmlRoot.SelectSingleNode("//dtr:Items",xmlns)

Dim xmlNodeList As XmlNodeList  = xmlRoot.SelectNodes("//dtr:Items/dtr:Item",xmlns)
Dim zones As New List(Of String) 

Dim zoneDict As New Dictionary(Of String, List(Of XmlNode))
Dim keys As New List(Of String)

Dim zoneNameToCombine As String = "Screens"
Dim zoneOrderToCombine As String  = GetZoneOrder(zoneNameToCombine)
Dim zoneOrderToRemove As String = GetZoneOrder("Video")


 For Each node As XmlNode In xmlNodeList
 
 	Dim zone As String  = node.SelectSingleNode("dtr:ZoneOrder",xmlns).InnerText

 	If(zone = zoneOrderToRemove) Then

 		node.SelectSingleNode("dtr:ZoneOrder",xmlns).InnerText = zoneOrderToCombine
 		node.SelectSingleNode("dtr:Zone",xmlns).InnerText = zoneNameToCombine
 		zone = zoneOrderToCombine
 			    
 	
 	End If
 	
 	If(zoneDict.ContainsKey(zone)) Then 	
 	
 		Dim xmlNodes As  List(Of XmlNode) = zoneDict(zone) 	
 		xmlNodes.Add(node) 		 	
 		
 	Else
 			keys.Add(zone)
 		Dim xmlNodes As New List(Of XmlNode)
 		xmlNodes.Add(node)
 		zoneDict.Add(zone, xmlNodes) 		
 	End If
 
Next

keys.Sort()

xmlItemsRootNode.RemoveAll()

For Each key As String in keys

		Dim xmlNodes As  List(Of XmlNode) = zoneDict(key) 
		
		For Each node2 As XmlNode in xmlNodes
			
			xmlItemsRootNode.AppendChild(node2)
			
		Next

Next

ds.Document.Save(ds.FileURL)

 Dim xmlDS As New DataDynamics.ActiveReports.DataSources.XMLDataSource(ds.FileURL, ds.RecordsetPattern)
	rpt.DataSource = xmlDS
	
		xmlDS.LoadXML(xmlDS.Document.OuterXml)
				
 'reset the Xml Document
 ReportUtilities.SetXMLDocument(xmlDS.Document)

End Sub


Function  GetZoneOrder( zoneName As String) As String

Dim zoneOrder As String = String.Empty

Dim zoneNode As XmlNode = xmlRoot.SelectSingleNode("//dtr:Project/dtp:Zones/dtp:Zone[dtp:Name='" + zoneName +"']",xmlns)

If Not zoneNode Is Nothing Then

	zoneOrder = zoneNode.SelectSingleNode("dtp:Order",xmlns).InnerText
	
End If

Return  zoneOrder

End Function
Hope it helps.
__________________
Narayana Karthik

Last edited by nkarthick; 05-02-2011 at 12:24 PM.
nkarthick is offline   Reply With Quote
Old 05-02-2011, 12:17 PM   #3 (permalink)
Member
 
Join Date: Apr 2011
Posts: 32
engcosta is on a distinguished road
Default

its not working
can you try any other code more easier that this ??
engcosta is offline   Reply With Quote
Old 05-02-2011, 12:29 PM   #4 (permalink)
Senior Member
 
Join Date: May 2009
Location: Chennai, India
Posts: 157
nkarthick is on a distinguished road
Default

Can you please explain what problem occurs (exactly) with the given code.

Same code working for me - Prices of Items in 'Video' zone included into the 'Screens' Zone perfectly.

Can you please try once again?

Easiest way - For now no Idea how to easily acheive it.
__________________
Narayana Karthik
nkarthick is offline   Reply With Quote
Old 05-02-2011, 01:46 PM   #5 (permalink)
Member
 
Join Date: Apr 2011
Posts: 32
engcosta is on a distinguished road
Default

its working fine now
thank you very much
engcosta is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:36 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.0
D-Tools, Inc.