vineri, iunie 09, 2006

Frontpage vs CPU vs Conditional Formatting

Oh, man this is really tough. Anyone else out there have this problem?

I have a view that has 42 conditional formatting possibilities, based on the web part data. When I load the page in FrontPage, in design view, FrontPage starts eating up all my memory and page file resources. Craps out my system entirely.

Most of the conditional formatting takes the status or category of some item and displaying an image based on the data in the item. For example, I have an issue list that has a status field with five or six different statuses, and using conditional formatting to display an icon (picture) on the screen indicating the status of the item.

I am displaying a big green button for 'On Plan' status, big yellow button for 'Caution' status, a big orange button for 'Concern' status, and a big red button for 'Worry' status, and of course, the obligatory nuclear explosion animated gif for 'OMG' status.

Each button has a different look based on the priority or severity of the issue.

Sounds like fun, eh? Not really.

And I have a solution - I shall post it sometime in the near future.

Filter List View with URL Parameter

Ok so I have tons of lists where I am tired of making a new view for every little John Doe and Jane Whatsherface that wants a new filtered view based upon the same list. There are a couple of references out there, but they are listed under some other search terms and hard to find using Google. Sharepoint would be completely useless to me if I didn't have google there, every step of the way bringing SharePoint hackers tips and tricks my way.

Anyway, on to the meat of this post:

  1. Open the page for the view you want to filter in FrontPage
  2. In design view convert the list view to XSLT (right-click, select Convert to XSLT Data View)
  3. Go into Code View (or use the Split view).
  4. Find ([CTRL-F]) the code: ParameterBinding Name="filterParam"
  5. Note that it says "Postback;Connection;" in the 'Location' field.
  6. Change the location to "Postback;Connection;QueryString(ID)" (This is case sensitive!)
  7. Note that you put "ID" as the QueryString variable. You could have just as easily put "Category" or "Subject".
  8. Go back into design view.
  9. Right-click the web part and select Data View Properties.
  10. In the 'Manage View Settings' window, click Filter.
  11. Under 'Field Name', choose the field in your web-part that you want to filter. As far as I know, it must match exactly with the name of the QueryString variable.
  12. Under 'Comparison', choose the method you want to filter by.
  13. Under 'Value', you must choose [Input Parameter].
Now, you can formulate URLs to pass a parameter to your view and filter that view based upon that parameter. Fun stuff.

Sample URL to pass the ID parameter: http://mysiteURL/subsite/lists/viewname.aspx?ID=4

Sample URL to pass a Category parameter: http://mysiteURL/subsite/lists/viewname.aspx?Category=Monkeys%20On%20Crack

Remember that once you apply the filter in Frontpage (steps 10 through 13), FrontPage will no longer display any of your data because FrontPage does not simulate any QueryString Variables. So, you need to make all your design/cosmetic changes in FrontPage prior to doing steps 10 through 13 above.

(Hint hint - Microsoft - you need to make it so that the FrontPage design view can simulate form inupt or QueryString Input so that we can see the data we would be working with if we had those filters in place!)

I have not tested passing two variables using this method. Maybe someday, although I have heard that passing two QueryString variables to a web-part is not possible. We'll see about that.

-------------------------
UPDATE: 01/31/2007:

I have passed multiple parameters!

Postback;Connection;QueryString(ID);QueryString(FirstName);QueryString(Lastname)

Note: to filter people, SP2003 likes FirstName^LastName (where ^ is a space), not ID or username.

I have a view that uses this method to filtering in all peoples who are on a project. I have a project list where people1, people2, people3 are assigned as people working on it. I have a link from the contact page like this:

http://teams.example.com/sites/QA/Lists/Regression/productivity.aspx?QATestera={@FirstName}%20{@Title}&QATesterb={@FirstName}%20{@Title}&QATesterc={@FirstName}%20{@Title}&QATesterd={@FirstName}%20{@Title}&Assigned%20To={@FirstName}%20{@Title}&ProjectManager={@FirstName}%20{@Title}

Well, I listed @Title as their last name, stupid, but oh well 'Dog with three legs doesn't make a good tripod' as we say.

Use these to filter like this:
Current = YES
Status NOT EQ COMPLETE

Then, group these user-lookup fields together:
QATestera = [Input Parameter] or
QATesterb = [Input Parameter] or
QATesterc = [Input Parameter] or
QATesterd = [Input Parameter] or
Assigned To = [Input Parameter] or

This will give you a list of projects that that user has anything to do with, not matter what the role. Just make sure to pass the role through the URL and pass it to the filter and parameterbinding.

miercuri, iunie 07, 2006

Export To Spreadsheet Woes

As you know, I have personalized my SharPoint site so dramatically, It no longer contains any original 'Out Of The Box' design elelments. As such, I would have liked to place a link somewhere on my page to export the list to a spreadsheet. This functionality is contained in the code:

%3Csharepoint%3Arelatedtasks+runat%3D%22server%22%3E

which provides all of the related taks, including exporting the list to a spreadsheet.

I do not want all of the other actions at this time, although, I am sure I will be needing to provide links to these items someday as well:

  • Add to My Links
  • View Reports
  • Alert Me
  • Export to spreadsheet
  • Modify Settings and Columns
Anyway, the primary focus of this article is how to get the export to spreadsheet function to do what I want it to do without having all that other stuff around.

The first thing I tried (don't laugh, it might have worked if it weren't for those meddling kids), was:
  1. Using the 'Out of The Box' AllItems.aspx template and clicked on the 'Export to spreadsheet' link
  2. Opening the list in Excel and saving a local copy.
  3. Upload my local copy to a document library
  4. Providing a link to the Excel file that I just uploaded into the document library and hoping for the best.
Needless to say, this didn't work because the list was not linked to the Excel file (hey - it was worth a go). So right-clicking the excel data did not provide the needed 'Synchronize with Sharepoint' option that I so desparately needed.

Then, I tried modifying the code as such:

%3Csharepoint%3Arelatedtasks+runat%3D%22server%22+list%3D%22JFHG837T%2D7629%2D438A%2DB7F3%2D92784GFH784G%22%3E

Which seemed to work, however, once the list was opened in Excel, only the ID field was displayed.

So, I opened the 'Out of The Box' AllItems.aspx template in ie and viewed the source.

This looked promising:

%3Ca+accesskey%3D%22P%22+id%3D%22diidIOExportToSpreadsheet%22+href%3D%22javascript%3A%22+onclick%3D%22%22+cs%3D%22109%26Using%3D%22+iqy%3D%22%22+list%3D%22%7B%3C%2Fspan%22%3E%3Cspan+style%3D%22font%2Dfamily%3Acourier+new%3B%22%3EJFHG837T%2D7629%2D438A%2DB7F3%2D92784GFH784G%3C%2Fspan%3E%3C%2Fa%3E%3C%2Fspan%3E%3Cspan+style%3D%22font%2Dsize%3A85%25%3B%22%3E%3Cspan+style%3D%22font%2Dfamily%3Acourier+new%3B%22%3E%3Ca+accesskey%3D%22P%22+id%3D%22diidIOExportToSpreadsheet%22+href%3D%22javascript%3A%22+onclick%3D%22%22+cs%3D%22109%26amp%3BUsing%3D%22+iqy%3D%22%22+list%3D%22%7B%3C%2Fspan%22%3E%7D+%26View%3D%7BH8UG5T6E%2D7625%2DJ92S%2DH7J8%2DMDXMQU8YT7UL%7D+%26amp%3Bamp%3Bamp%3BRootFolder%3D%26CacheControl%3D1%27%29%3Bjavascript%3Areturn+false%3B%22%3EExport+to+spreadsheet%3C%2Fa%3E

However, using that code only provided the ID field from my list, not all fields from my list, again. Removing the View Querystring was the answer, so now I have:

%3Ca+accesskey%3D%22P%22+id%3D%22diidIOExportToSpreadsheet%22+href%3D%22javascript%3A%22+onclick%3D%22%22+cs%3D%22109%26Using%3D%22+iqy%3D%22%22+list%3D%22%7B%3C%2Fspan%22%3E%3Cspan+style%3D%22font%2Dfamily%3Acourier+new%3B%22%3EJFHG837T%2D7629%2D438A%2DB7F3%2D92784GFH784G%3C%2Fspan%3E%3C%2Fa%3E%3C%2Fspan%3E%3Cspan+style%3D%22font%2Dsize%3A85%25%3B%22%3E%3Cspan+style%3D%22font%2Dfamily%3Acourier+new%3B%22%3E%3Ca+accesskey%3D%22P%22+id%3D%22diidIOExportToSpreadsheet%22+href%3D%22javascript%3A%22+onclick%3D%22%22+cs%3D%22109%26amp%3BUsing%3D%22+iqy%3D%22%22+list%3D%22%7B%3C%2Fspan%22%3E%7D+%26View%3D%26amp%3Bamp%3Bamp%3BRootFolder%3D%26CacheControl%3D1%27%29%3Bjavascript%3Areturn+false%3B%22%3EExport+to+spreadsheet%3C%2Fa%3E

Which works!

luni, iunie 05, 2006

Sharepoint - DispForm.aspx, EditForm.aspx, NewForm.aspx

Ok, so here I am working along on my SharePoint list. I have this project list that I am using a SP 'Issue' type list for, because it keeps the historical information about what changes were made.

So, I decide that I am going to modify most of the views using FrontPage so that it no longer looks anything like a Sharepoint list. As you get to know me, you will realize that I absolutely dislike the SharePoint themes, and FrontPage themes. I need to make it look like what I want it to look like. ows.css is out too, or modified beyond all recognition.

Don't you love it when you right-click the list and "Customize SharePoint List Form" only to find that it has changed into what looks like a pool of question marks.

Anyway, my point is that I now know what it means to have worked on a list for so long, only to have lost it because you did something stupid and saved changes to 'DispForm.aspx', only to find out that it broke your whole list! How can one recorver DispForm.aspx? How can we restore DispForm.aspx?

Hopefully, you did not modify EditForm.aspx. If you did, you are almost SOL, but not quite. You can almost do the same thing using AddForm.aspx, however, you will not get the issue history like you can with EditForm.aspx.

Ok, so here is the solution:

  • Open EditForm.aspx
  • Right-click the list, (in design view), and select 'List Form Properties'
  • Enable 'Display item form (used to view list items)'
  • Save the file as 'DispForm.aspx' (or something else, if you like)

    This should recover your list.

Despre mine

Timi-Ostravia, Republic of Czedvia, Bulgaria
I make web applications. The tools I use are many and far between. I have been maining to learn Ruby and Python, and Perl. These tools are all like Lego to me. They can all be make to build things and have their strengths and weakest.