开发者

Querying a Sitecore Droplink field

开发者 https://www.devze.com 2023-02-03 02:46 出处:网络
The following Sitecore query works for me in the XPath Builder: /sitecore/content/Home/CareAndTreatment//*[@Title=\'Birth Marks and other skin conditions\']

The following Sitecore query works for me in the XPath Builder:

/sitecore/content/Home/CareAndTreatment//*[@Title='Birth Marks and other skin conditions']

But a similar query that checks on a DropLink field instead of a Single-Line Text field does not return any results:

/sitecore/content/Home/CareAndTreatment//*[@TreatmentType='Conditions']

Is there a 开发者_开发问答syntax difference in the query language for Single-Line Text versus Droplink?

[NOTE: These examples use Sitecore 6.2]


I could be wrong, but... Isn't the DropLink field storing the item ID rather than the text? So you'd have to query against that.

DropList - stores text as raw value
DropLink - stores ID as raw value

Maybe the Query API takes this into account?


The solution is not that hard, prefix it with query, e.g.:

query:/sitecore/content/Home/CareAndTreatment//*[@TreatmentType='Conditions']

See also: http://sdn.sitecore.net/Reference/Sitecore%206/Data%20Definition%20Cookbook.aspx (2.4.2)

0

精彩评论

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