SharePoint designer is very powerful tool for SharePoint
branding as well as accomplishing tasks with minimal efforts. I always liked
the Data view web part I have created number of DW web parts wherever required.
In this post I will explain Linked Data Source Data view and
some challenges while filtering this view.
I had 10 lists with similar structure and I was looking for
merging these in single data source and display filtered data for current login
user. So let’s start with implementation.
1.
Create Linked Data Source : -
·
Open your SP site in SharePoint Designer. Data
Sources option will be available in left section in Site Objects.
·
Click on Data Sources. Linked Data Source,
Database connection etc. option will be displayed in ribbon.
·
Click on Linked Data Source -> In General Tab
give name for your Data source. In Source tab click Configure Linked Source;
wizard will open to select lists you want to be in your data source. Select
lists and click next to select Merge/Join to finish Linked Data Source
Creation.
2.
Create Data View web part:-
·
Create a
new page and empty Data view web part on page. (Insert -> Data View ->
Empty Data View)
·
Click on Select Data Source, all data sources
will be shown to you .Our data source will be shown in category “Linked
Sources”. Select source in step 1.
·
Select fields you want to display from right
section and display them as multiple item view.
·
This is it; your data view web part is ready
with linked Data Source.
3.
Filtering Data View :-
Now I
was trying to filter above Data view with Current login user .I was comparing
this with AssignedTo user field in above Data Sources. My Filter
criteria was below
AsignedTo equals
[Current User]
It works with list Data view web part, however somehow it
was not working here. After some analysis I found filter section in XSLT of
this web part as below:
I checked fields added, and modified above code to below and
my current user filter Worked …!
select="/dsQueryResponse/Rows/Row[normalize-space(@AssignedTo.title) = $UserID]"
4.
Change Created Date
Use below function to modify Date formatting in Data View
:
ddwrt:FormatDateTime(string(@Created), 1033, ‘MM/dd/yyyy’)"
No comments:
Post a Comment