How to Group Data View Web Part by Additional Fields of a Lookup Column? RRS feed

  • Question

  • I have created a data view web part which consolidates information from multiple lists. The web parts contains about 10 columns but I will focus on two columns; "Facility" "Facility: State".

    In the source lists, "Facility" is a lookup column, which also returns the associated state, resulting in an additional field: "Facility:State".

    (In dvwp, I used substring-after to get the data from looking like 2;#New Jersey and 1;#New Jersey to look like New Jersey)

    Now when I display this information on my dvwp and group it by "Facitliy:State" it does not group the data by one state. For example if I have two different facilities in New Jersey, it will create one group for New Jersey with only Facility A and second group for New Jersey with only Facility B.

    I believe this is occurs because "Facility: State" is linked to values in the "Facility" column. Is there a way I can create a calculated column based on "Facility: State" in dvwp, so that the calculated column only returns the text part of "Facility: State" and allows me to group based on state with no facility distinction??


    Thursday, April 12, 2012 6:26 PM


  • Found a solution:

    Instead of simply adding "Facility:State" to the groups. I used edit sort expression and used substring-after to group by only the text portion of the state information.

    • Marked as answer by svaa Wednesday, April 18, 2012 4:00 PM
    Wednesday, April 18, 2012 4:00 PM