2013-03-12 56 views
0

我試圖通過Sitecore Rocks查詢分析器使用Sitecore查詢語言將一堆項目更新爲新的工作流,同時保持當前狀態。我目前有這樣的:Sitecore查詢語言:更新+其中

update set @#__Workflow state# = "--GUID of the workflow state--" from //*[@@id='--GUID of the parent Item--']/* 

這個工程。我想要做的是包含一個,其中陳述,以便我可以保留草稿/等待批准/批准狀態,同時仍然切換工作流程。

update set @#__Workflow state# = "--GUID of the DRAFT workflow state--" from //*[@@id='--GUID of the parent Item--']/* where @#__Workflow state# = "--GUID of the original DRAFT workflow state--"; 
update set @#__Workflow state# = "--GUID of the APPROVED workflow state--" from //*[@@id='--GUID of the parent Item--']/* where @#__Workflow state# = "--GUID of the original APPROVED workflow state--"; 

但是這不起作用。我是否在使用我的時出現語法問題,其中子句或其中未與Sitecore查詢語言中的更新一起使用。

回答

1

「Where-clause」在查詢語句中不起作用。

你應該使用使用/ * [@字段名= 「值」]選擇的項目,如:

update set @#__Workflow state# = "--GUID of the DRAFT workflow state--" from //*[@@id='--GUID of the parent Item--']/*[@#__Workflow state# = "--GUID of the original DRAFT workflow state--"]; 

update set @#__Workflow state# = "--GUID of the APPROVED workflow state--" from //*[@@id='--GUID of the parent Item--']/*[@#__Workflow state# = "--GUID of the original APPROVED workflow state--"];