Hide-whens in SharePoint!
December 14, 2007
I had mentioned quite some time ago that one feature SharePoint just didn’t have was hide-when formulas.
Let me state here and now that I was mistaken.
Just this morning, I figured out how to do hide-whens in SharePoint. I don’t have the full range of options provided by the @Functions in Notes, but I can hide form UI based on data within that form.
I will try to expand on this later (I’ve already got 3 topics lined up to post about… just need to find the time), but in brief:
- Edit your list pages in SharePoint Designer (NewForm.aspx, etc)
- Hide the default list web part on that form. (Apparently it must be hidden, not deleted… i haven’t tested to see why that is.)
- Add a Custom List Web Part to the form
- Modify the XSL in that new web part.
That’s it. Now that you are working in XSL, you can use xsl:if to write logic to choose exactly what UI components should / should not display.
This technique won’t give you the full capabilities of Domino’s hide-whens, as it limits your logic to the list data… but that is better than nothing, and still fairly powerful. I intend to do more research to see if I can pull in more environment/session/user data to expand the capabilities of this concept.
And I suppose this also means I need to become much stronger with XSLT. I’ve suspected for years that XSLT is a skill I need to pick up. This forces the issue.
Posted in Coding, sharepoint | 5 Comments »
Tags: domino, Hide-whens, sharepoint, XSLT
5 Responses to “Hide-whens in SharePoint!”
Comments are closed.
December 14, 2007 at 9:43 am
Hi,
I have a question, NOT related the hide-when topic though. I understand the MS does NOT recommend having more then 2000 items in a view. If we need more than 2000 items, MS recommends creating folders.
If we want to migrate a Notes App that has more than 30000 docs in the views, do we have to create 15 folders and let the user figure out a way to locate a particuler document?. Whats the best approach?
Thanks.
December 15, 2007 at 9:31 am
That is a question I’ve been asking myself for some time now. The best answer will probably depend on the application:
For an app that has 30,000 records, all using the same form, it might be better to move that data to SQL Server, write a ASP.NET control for the read/update of the data, and import that control into SharePoint using a SmartPart.
If the 30,000 records are using different forms, you can split the records into separate lists in SharePoint as well as separate folders.
You can also always try to create a Search Scope to help your users search just within those records.
The truth is that any set of 30,000 documents is probably too much for an end user to browse. You will need to devise either a navigation of search option to help them. The details will all depend on the exact data and how it used.
January 3, 2008 at 6:29 am
@1: The 2000 items limit is not a hard limit. SharePoint will support list a lot larger than that and still be supported by MS.
The reason MS mention the 2000 item limit is purely with respect to the user experience as it simply takes too long for SharePoint to fecth the data from SQL if the item list is larger than 2000.
To speed up thing a bit, MS suggests either using folders or using views (e.g. by showing the same document library on the same page multiple times, but with different views). An example can be to have all Word files in one view and all XLS files in another view.
Either way, it enables SharePoint to optimize (probably by using a simple WHERE-clause) what data is getting fecthed from SQL and thus enhance the performance experience.
February 28, 2008 at 9:16 pm
I too am a former Notes Developer. I miss the @Formulas, the lotus script, the integrated Development Environment. I basically miss everything. I can’t understand why I need 3 tools to make changes to something. I am faced with a similiar hide when situation you mention. I have located the xsl if and test=”" to hide fields based on condition. My question is does this work live on the form or only after save and reopen? Does the data need to exist for it to render the condition on a list form?
March 2, 2008 at 4:01 pm
@4) Only after a save and re-open. The data must exist in the list item. So it isn’t perfect, but it probably will do the trick in most cases.