Interstage Shunsaku Data Manager Application Development Guide - Microsoft(R) Windows(R) 2000/ Microsoft(R) Windows Server(TM) 2003 - - UNIX -
Contents Index PreviousNext

Part 2 Developing Applications by APIs> Chapter 10 Developing .NET Applications> 10.3 How to Use .NET APIs> 10.3.2 Data Searches

10.3.2.1 Obtaining the Number of XML Documents that Match Search Conditions

Sometimes it is desirable to obtain the number of items that match specific search conditions before extracting the actual data.

In this case, use the GetHitCount method to specify the search expression and obtain only the number of hits.

The following diagram shows the process for obtaining the number of XML documents that match specified conditions.

[Figure 10-5 Flow of the Process for Obtaining the Number of XML Documents that Match Conditions]

mark1Sample Code for C# .NET

ShunService service = new ShunService();
service.Connect();

int hitCount = service.GetHitCount( "/document/base/prefecture == 'Sydney'" );         (1)
Console.WriteLine( "[Number of hits] = {0}", hitCount );

service.Disconnect();

mark1Sample Code for VB .NET

Dim service As New ShunService()
service.Connect()

Dim hitCount As Integer = service.GetHitCount( "/document/base/prefecture == 'Sydney''" )  (1)
Console.WriteLine( "[Number of hits] = {0}", hitCount )

service.Disconnect()

mark2(1) Obtain the Number of XML Documents that Match Search Conditions

Specify search conditions at the arguments of getHitCount to obtain the number of hits.

Refer to Appendix B Format of Search, Return and Sort Expressions for more information on search expressions.


Contents Index PreviousNext

All Rights Reserved, Copyright(C) FUJITSU LIMITED 2006