特定管理 > 訂做企業物件 > 物件初始化規則管理 > 使用物件初始化規則 > 規則演算法 > 資料夾位置欄位的條件約束演算法用法
  
資料夾位置欄位的條件約束演算法用法
若要控制當使用者選取資料夾路徑時顯示給他們的資料夾位置選項,Windchill 使用者介面可讓您在 folder.id 屬性的 AttrConstraints 標籤中指定條件約束演算法的組合。
* 
對於 folder.id 屬性使用條件約束時假設也設定了預設值 (如設定預設資料夾路徑範例中所述)。
下列資料夾位置選項可供使用:
將位置顯示為一個預先生成的唯讀值,方法是指定 GetServerPreGeneratedValue 演算法,它會顯示針對 folder.id 屬性設定的預設值。
欲使選項自行使用,也請指定 GetImmutableConstraint 演算法。例如:
<AttrValue id="folder.id"
algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm">
<Arg>/Default</Arg>
</AttrValue>
<AttrConstraint id="folder.id"
algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
<Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/>
<Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/>
</AttrConstraint>
顯示如下所示:
在此範例中,folder.id 屬性的預設值為 /GOLF_CART。
將位置顯示為從針對 folder.id 屬性設定的預設值中自動產生的唯讀值,方法是指定 GetServerAssignedConstraint 演算法。
欲使選項自行使用,也請指定 GetImmutableConstraint 演算法。例如:
<AttrValue id="folder.id"
algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm">
<Arg>/Default</Arg>
</AttrValue>
<AttrConstraint id="folder.id"
algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
<Value algorithm="com.ptc.core.rule.server.impl.GetServerAssignedConstraint"/>
<Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/>
</AttrConstraint>
顯示如下所示:
顯示位置,以便使用者可以使用顯示在欄位中的資料夾位置或瀏覽至不同資料夾,來選取資料夾。
用來確定最初顯示在欄位中的資料夾位置的邏輯會將使用者可以從中選取資料夾的使用者介面中的所有不同位置列入考慮範圍,而且會針對每種情況顯示最適合的資料夾位置。例如,當使用者從與 Design 資料夾關聯的「資料夾內容」表格中按一下圖示來建立物件時,顯示在欄位中的資料夾位置就是從中按一下圖示的資料夾 (在此例中為 /GOLF_CART/Design)。
如果您指定條件約束演算法的空白清單,此選項可自行使用。例如:
<AttrConstraint id="folder.id"
algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints"\>
顯示如下所示:
也可以指定 GetServerAssignedConstraint 演算法或 GetServerPreGeneratedValue 演算法來與其他選項結合使用此選項。
* 
欲顯示此選項,您不得在條件約束清單中指定 GetImmutableConstraint 演算法。
如需顯示資料夾位置欄位的受支援使用者介面選項組合及用來產生顯示的條件約束演算法的範例,請參閱「基本自訂」一節的位置