Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,
I trying to get the result as per no of collapseSpecification in a single request from the SharePoint API.

I am trying to explain the scenario:-
Raw Data in SharePoint :-																																
D	R	A	D	D	A	A	E	D	R	E	A	A	R	T	D	T	T	E	E	T	B	C	B	B	R	C	F	G	F	C	B	B


After Sort and Group by Name (collapseSpecification ) of Raw Data in SharePoint	:-																															
A	A	A	A	A	B	B	B	B	B	C	C	C	D	D	D	D	D	E	E	E	E	F	F	G	R	R	R	R	T	T	T	T


Result-set as per query									

1) Start-0 limit-10									
A	A	A	A	A	B	B	B	B	B

2) Start-21 limit-10									
E	E	F	F	G	R	R	R	R	T

3) Start-31 limit-10								
T	T	T						


What I have tried:

I implemented this:-
C#
kq.CollapseSpecification = string.Format("{0}:{1}", "Name", "5");
            kq.StartRow = args.Offset;
            kq.RowLimit = args.Limit;

as you can see I used CollapseSpecification with property_name is "Name" and size "5", so we don't have 5 no of data with the same name that's why its returning less then 5 no of datas (like "E","F","G" etc.). If I tried to get the data with pagination (StartRow & RowLimit ) then it might return same data in next result-set(result-set 2 and 3 both have "T"), but I don't want that.

So I need to get the result as per no of CollapseSpecification.
Is there anyway to do this:-

Expected Result:-											
No of Name group 2 (per page)											
A	A	A	A	A	B	B	B	B	B		

No of Name group 2	(per page)							
C	C	C	D	D	D	D	D	

No of Name group 2	(per page)							
E	E	E	E	F	F			

No of Name group 2	(per page)							
G	R	R	R	R				

I am implemented this with KeywordQuery in C#.

Thanks in Advance.
Any suggestions are welcome.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900