开发者

How to group by a calculated column in a Content Query Web Part

开发者 https://www.devze.com 2023-01-05 16:19 出处:网络
I\'m trying to build a Custom Query Web Part that pulls data from multiple lists (or I\'d just do this with a List View) and I want to group the data by first letter, A-Z. Right now I have a calculate

I'm trying to build a Custom Query Web Part that pulls data from multiple lists (or I'd just do this with a List View) and I want to group the data by first letter, A-Z. Right now I have a calculated column that is using =LEFT(Title,1) to determine the first letter of each data entry. Even if I modify the .webpart file's GroupBy property for the CQWP to force it to group by my calculated column ("Letter"), though, the query comes up e开发者_如何学运维mpty because it can't group by a calculated column. Does anyone know of another way I can do this, or a way to make Sharepoint have a static column of the calculated value?


Unfortunately you'll have to make this using a combination of a field and a SPItemEventReceiver, so you generate a readonly field and make a EventReceiver, which updates it in ItemAdding and ItemUpdating

0

精彩评论

暂无评论...
验证码 换一张
取 消