Thursday, July 9, 2009

SpooblCloog

SharePoint Out of the box Limitaion Cloog

A thing on a thing on a thing

This is a term I just invented to refer to things we have to do to get around the limitations of sharepoitn out of the box
example:::

In the marketing subsite I have a document library - and I want to be able to classify something as either product related or service related.What I have tried:I started with 3 columns1. a "product or service" choice column (that has 2 choices prod or svc)2. a "Products" choice column (with all the products listed as choices) to classify which "product" the marketing document relates to.3. Ditto for the "Services" column

I was able to get things working pretty well with this scenario - but it is not very "pretty" - and puts too much responsibilty on the users to enter the right thing.

Improvements I'd like to make:
1. A separate list for the products - the doc lib needs to look up the product from another list that has additional info about the products (preferrably at the site collection level - so that list can be used for lookups on other sites as well)
2. ditto for the list of services
3. make the "product or a service" column a calclated one
4. Perhaps have prods and services in the same list? - although they have different attributes - so 2 lists is probably okay

What I am having issues with:
1. I got the calculated column to work - using this formula

=IF(Producx<>"",IF(Servicez<>"","Both","P"),IF(Servicez<>"","S","n/a"))

works like a charm

BUT you'll notice the funky names of my fields - thats because those are faux fields - with the products hard coded into the choice list

when I try to use my fields that are REAL lookup fields to the Products LIST - I can't refer to that field!

2. I am going to try creating a formula in SPD and see if that works -BUT I am struggling with a "server returned a non-specific error" issue (anybody have tips on how to troubleshoot that?) I will post about how that works out - later...

4 comments:

  1. - okay got my dataview to load - and NO - you can't reference lookups in a formula in SPD either

    That seems to violate the whole concept of it being a lookup - isn't that WHY you have that elsewhere - to normalize the data?

    Hopefully one of you geniuses has figured out a work around

    ReplyDelete
  2. -- I tried creating a workflow that will update the "prod or svc" column -based on the values in the "Products" and/or "Services" columns.

    I ran into issue with infinite looping - I know this is somethign I could probably get to work with enough ifs ands or buts

    BUT it just seemed like ALOT of configuring for a simple problem - so I thought I'd see if someone has an easier way

    ReplyDelete
  3. Okay I got it!

    I followed
    -- this article (thank you Kevin - awesome input)
    Workflow for a Projects list:
    http://www.sharepointkevin.com/Lists/Posts/Post.aspx?ID=17

    -and referred to this one
    Run a workflow when a specific field changes:
    (which I hade read a long time ago - but did not have a need for until now)
    http://office.microsoft.com/en-us/sharepointdesigner/HA102564191033.aspx

    I created the prod and svc lists at the root site collection level
    I pointed my lookup Site Columns at them
    I have a calculation that happens in a workflow and in order to get it to fire on new AND on changed I had to create 2 additional "mirrored" columns to get both working without an infinite loop

    The workflow is like so...
    step 1 is
    -check for differences in prod and prod-mirror
    -ditto for services
    (if no change exit the workflow)
    step 2 has 4 conditions
    -check for is products empty && is services empty == n/a (not prod or service)
    -check for is products NOT empty && services NOT empty == Both
    -check for is products Not empty && is services empty == Product
    -check for is products empty && is services NOT empty == Services
    and the action for each condition above is to store the result in a variable

    Step 3 is to assign that variable to the column in the list "product or service"
    and then to set the prod-mirror column equal to the product column's value (resetting the flag for future changes)

    Fixing the forms:
    seems to work like a charm - Since my columns are all SITE columns - I can hide the mirror fields as well as the calculated fields so they don't show up in my edit forms
    here are a couple of articles about that
    If you aren't using Site Columns and you have to hide them in the form (like Kevin describes) beware - it's not as straightforward as the sharepoint online team would lead you to belive
    http://office.microsoft.com/en-us/sharepointdesigner/HA101191111033.aspx
    this article shows the correct way (sort of)
    http://www.sharepointu.com/dwise/archive/2007/11/14/lesson-learned-while-customizing-newform-aspx.aspx
    There is another thing you have to do to hide the sharepoint list control
    I just used a div tag and used css to hide it

    BUT - if you do have site columns - (even if you don't you might consider turning them into site columns)I think it is a much slicker way to handle it

    Hope this helps someone else struggling to put this all together - declarative programming is an intersting animal to say the least

    ReplyDelete
  4. Got this error and paniced...

    Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries

    I got the above error due to the fact that I had changed the name of a variable in my workflow - and then I forgot to go and change it in my conditions and actions

    - just thougth I'd throw that out there - in case anyone else comes across that error - due to workflow realted stuff

    ReplyDelete