xsl dataview webpart groupby left characters of a string
Posted on 2013-01-11
I have a sharepoint 2010 list with a column "proposalID". The values in that column are
5555-01, 5555-02, 5555-03, 6666-01, 6666-02, etc.
I want to group by the 4 characters to the left of the dash. So the grouping would display 3 items under 5555 and 2 items under the group 6666, etc.
In Sharepoint Designer, on my dataview webpart, I set the sorting by ProposalID - which renders the xsl as follows:
<xsl:when test="not ($dvt_groupfield)"><xsl:value-of select="ddwrt:NameChanged(string(@ProposalID), 0)" /></xsl:when>
My question is - how do I alter that xsl so that the grouping is done based on the 4 left characters?
I've not had luck with any substring syntax I've tried - so I'm stuck.
Thanks in advance.