locked
Using the Meeting Date of a Meeting Workspace in WSS as a parameter RRS feed

  • Question

  • Hello,

    I am creating a meeting site template that pulls in data from the top level SharePoint site.  A requirement is that the data in the DVWPs be filtered based on the meeting date.  I have been unsuccessful in my attempts to find a solution.  I would prefer to use SPD or the browser to make customizations as I am not familiar with using Visual Studio to work with SharePoint (though I have it so if that is the only option then so be it).

    The site is WSS v3 with all recent updates applied.

    Thanks in advance,
    Jonathan

    Monday, March 5, 2012 6:38 PM

Answers

  • Thanks for following up.  I have found a solution that I will post at the bottom of this message.

    I didn't really care how the date was passed to the DVWP, however I needed it to be the date of the meeting, not the current date.  This date will then be used to filter multiple DVWPs from the root site.  SharePoint would not allow the Meeting Date WebPart to be passed in a Meeting Workspace, probably because it is optional (IE the meeting doesn't have to have a date).  My original idea was to use an ASP hidden field to set the date, however this proved to be more difficult than I imagined.  

    I ended up using a QueryString to set the meeting date and some JavaScript to read the date from the page.  In my testing, this solution appears to be working correctly.  I hate that the page has to refresh in order to set the Query String, but that was the only method I found to work.  Below is the JavaScript I used:

    <!-- Javascript to populate the Query String to filter the DVWPs on the meeting date -->
    <script type="text/javascript" language="javascript">
    	
    	function UpdateQueryString()
    	{	
    	
    	var urlHref = document.location.href.toString();
    	
    	//check if the QueryString has been set
    	if (urlHref.match("MeetingDte"))
    	{
    		//alert("Query String Set");
    	}
    	else {	
    		//alert("Update Query String Start");
    		var hiddenDateControl = document.getElementById("MeetingDate").outerHTML;
    	    
    	    //regex's to filter out the individual dates
    	    var datePattern = /\d{1,2}\/\d{1,2}\/\d{4}/;
    	    var monthExp = /\d{1,2}/;
    	    var dayExp = /\/\d{1,2}/;
    	    var yearExp = /\d{4}/;
    	    
    	    var strDate = hiddenDateControl.match(datePattern);
    	    var wMonth = strDate.toString().match(monthExp);
    	    var wDay = strDate.toString().match(dayExp);
    	    var wYear = strDate.toString().match(yearExp);
    	    
    	    //remove the '/' left by the regex filter
    	    wDay = wDay.toString().substring(1);
    	    
    	    //alert(wMonth + " " + wDay + " " + wYear);
    	    
    	    var dateString = new Date(wYear, wMonth, wDay);
    	    
    	    //string that formats the date into yyyy-mm-ddT00:00:00Z
    	    var formattedDate = dateString.getYear() + "-" + ("0" + (dateString.getMonth() )).slice(-2) + "-" + ("0" + dateString.getDate()).slice(-2);
    	    formattedDate = formattedDate + "T" + ("0" + (dateString.getHours() )).slice(-2) + ":" + ("0" + (dateString.getMinutes() )).slice(-2) + ":" + ("0" + (dateString.getSeconds() )).slice(-2) + "Z";
    	    //alert(formattedDate);
    		
    		ApplyFilter(formattedDate);
    	}}
    
         function ApplyFilter(date)
    	// refreshes the page with the appropriate Query String
         {                 
    
         document.location.href = "?MeetingDte=" + date;   
    
         }
         
    _spBodyOnLoadFunctionNames.push("UpdateQueryString");
    </script>
    


    • Marked as answer by JonDeco Friday, March 9, 2012 4:07 PM
    Tuesday, March 6, 2012 4:10 PM

All replies

  • Hi Jonathan,

    How are you planning to pass the meeting date parameter to the DVWP? Can you please let us know details about the attempts you made to get the filtering to work?

    I tried creating a DVWP in a subsite which displays data from the root site. Then I filtered the data based on a parameter [Today's date]. This scenario worked fine. Do let us know more about your scenario so that we can help you with a possible solution.


    Regards, Mahesh

    Monday, March 5, 2012 9:17 PM
  • Thanks for following up.  I have found a solution that I will post at the bottom of this message.

    I didn't really care how the date was passed to the DVWP, however I needed it to be the date of the meeting, not the current date.  This date will then be used to filter multiple DVWPs from the root site.  SharePoint would not allow the Meeting Date WebPart to be passed in a Meeting Workspace, probably because it is optional (IE the meeting doesn't have to have a date).  My original idea was to use an ASP hidden field to set the date, however this proved to be more difficult than I imagined.  

    I ended up using a QueryString to set the meeting date and some JavaScript to read the date from the page.  In my testing, this solution appears to be working correctly.  I hate that the page has to refresh in order to set the Query String, but that was the only method I found to work.  Below is the JavaScript I used:

    <!-- Javascript to populate the Query String to filter the DVWPs on the meeting date -->
    <script type="text/javascript" language="javascript">
    	
    	function UpdateQueryString()
    	{	
    	
    	var urlHref = document.location.href.toString();
    	
    	//check if the QueryString has been set
    	if (urlHref.match("MeetingDte"))
    	{
    		//alert("Query String Set");
    	}
    	else {	
    		//alert("Update Query String Start");
    		var hiddenDateControl = document.getElementById("MeetingDate").outerHTML;
    	    
    	    //regex's to filter out the individual dates
    	    var datePattern = /\d{1,2}\/\d{1,2}\/\d{4}/;
    	    var monthExp = /\d{1,2}/;
    	    var dayExp = /\/\d{1,2}/;
    	    var yearExp = /\d{4}/;
    	    
    	    var strDate = hiddenDateControl.match(datePattern);
    	    var wMonth = strDate.toString().match(monthExp);
    	    var wDay = strDate.toString().match(dayExp);
    	    var wYear = strDate.toString().match(yearExp);
    	    
    	    //remove the '/' left by the regex filter
    	    wDay = wDay.toString().substring(1);
    	    
    	    //alert(wMonth + " " + wDay + " " + wYear);
    	    
    	    var dateString = new Date(wYear, wMonth, wDay);
    	    
    	    //string that formats the date into yyyy-mm-ddT00:00:00Z
    	    var formattedDate = dateString.getYear() + "-" + ("0" + (dateString.getMonth() )).slice(-2) + "-" + ("0" + dateString.getDate()).slice(-2);
    	    formattedDate = formattedDate + "T" + ("0" + (dateString.getHours() )).slice(-2) + ":" + ("0" + (dateString.getMinutes() )).slice(-2) + ":" + ("0" + (dateString.getSeconds() )).slice(-2) + "Z";
    	    //alert(formattedDate);
    		
    		ApplyFilter(formattedDate);
    	}}
    
         function ApplyFilter(date)
    	// refreshes the page with the appropriate Query String
         {                 
    
         document.location.href = "?MeetingDte=" + date;   
    
         }
         
    _spBodyOnLoadFunctionNames.push("UpdateQueryString");
    </script>
    


    • Marked as answer by JonDeco Friday, March 9, 2012 4:07 PM
    Tuesday, March 6, 2012 4:10 PM
  • Better yet, hijack the javascript call that the meeting instance selector on the left side of the page uses.

    Search the code for "MtgNavigate" and change to "MtgNavigate2", then use this code. Thanks to JonDeco above, as I used some of his solution combined with what is being done in the stock "MtgNavigate" function. This is the best of both worlds, as you don't need to reload the page.

    function MtgNavigate2(InstID)
     //hijack the Meeting Series javascript call
     {
     
     //alert(InstID)
     
     var wYear = InstID.substr(0,4)
     var wMonth = InstID.substr(4,2)
     var wDay = InstID.substr(6,2)
     
     var formattedDate = wYear + "-" + wMonth + "-" + wDay
      
     ULSrLq:;
     if(InstID==g_instanceId)return;
     var b=!g_fPageGlobal;
     window.location.href=GetPageUrl(b)+"?MtgDate="+formattedDate+"&"+"InstanceID="+InstID+"&"+g_thispagedata

     
     }

    Thursday, October 24, 2013 3:01 PM