; Define your Customer Rules to control Objects.P.State depending on JobResults.
; #Doc.: Date of Template : 18.10.2022/S.Gueth
; #ToDo: Delete not Used Examples, and Edit Rules as required.
; ------ ----- ----- ----- ----- ----- ----- ----- -----
; #Doc1: to change State of other Process.Groupes add def at the end of the Rule.
; #Doc1: |-> #Example: Status for PGroup P.01 [P01.Stat=RUN] [P02.Stat=RUN] 
; #Doc1: |-> #Example: Status relativ PGroup  [P+1.Stat=RUN] [P+2.Stat=RUN] -> (#New 12.03.2020)
; ------ ----- ----- ----- ----- ----- ----- ----- -----
; #Doc2: to reset status to previous state when result code is empty use def [P.Stat={PreState}]
; #Doc2: |-> #Example: [RuleID=PreState] [O.Type=*] [J.ResCode=] [J.ResMsg=*] [J.ResWarn=*] [P.Stat={PreState}]
; ------ ----- ----- ----- ----- ----- ----- ----- -----
; #Doc3: to set other P.Results Rule with definitions: [P.ResCode=??] [P.ResMsg=Cutom Message] [P.ResWarn=0/1] [P.ResLink=]
; #Doc3: |-> #Example: [RuleID=Custom P.def] [O.Type=*]  [J.ResCode=*]  [J.ResMsg=*SUCCESS*]        [J.ResMsgExt=*] [J.ResWarn=*] [P.Stat=D.01.OK]  [P.ResCode=0]  [P.ResMsg=CustomMsg:SUCCESS WELL Done] [P.ResWarn=false] [P.ResLink=www.plmjobmanager.com]
; #Doc3: |-> #Example: [RuleID=Custom P.def] [O.Type=*]  [J.ResCode=*]  [J.ResMsg=*Part not found*] [J.ResMsgExt=*] [J.ResWarn=*] [P.Stat=D.02.ERR] [P.ResCode=02] [P.ResMsg=CustomMsg:Part not found]    [P.ResWarn=false] [P.ResLink=www.plmjobmanager.com]
; ------ ----- ----- ----- ----- ----- ----- ----- -----
; #Doc4: use PStatKey definition for esay generate PStatus Rule for D.#PStatKey#.OK/D.#PStatKey#.WRN/D.#PStatKey#.ERR (#New 12.03.2020)
; #Exa4: [PStatKey=R1] 
; #Dxa4: CASE P.RES=OK O.PGr.(01..20).PStat='D.R1.OK' // P.WRN=OK O.PGr.(01..20).PStat='D.R1.WRN' // P.RES=ERR O.PGr.(01..20).PStat='D.R1.ERR'
[PStatKey=R1]

; ------ ----- ----- ----- ----- ----- ----- ----- -----
[P.Control=#RuleName#]
; Can be used to trigger a specific JobControlActivRule that is defined in 'Job Control Rules' -> 'Job Def Extended 2' -> '3.4: JobMgr - Activation Status Control'
; Example:
; [RuleID=ERR] [O.Type=*] [J.ResCode<>0] [J.ResMsg=*] [J.ResWarn=*] [P.Stat=D.ERR] [P.Control=DeactivateJobRule]

;-- #Rule: Test	 Results: OK:D.T.OK // WRN: D.T.WRN // ON ERR: D.T.ERR 
[PStatKey=T]
[RuleID=OK]      [O.Type=*] [J.ResCode=0]  [J.ResMsg=*] [J.ResMsgExt=*] [J.ResWarn=0] [P.Stat=#PStatAuto#]
[RuleID=WRN]     [O.Type=*] [J.ResCode=0]  [J.ResMsg=*] [J.ResMsgExt=*] [J.ResWarn=1] [P.Stat=#PStatAuto#]
[RuleID=ERR]     [O.Type=*] [J.ResCode<>0] [J.ResMsg=*] [J.ResMsgExt=*] [J.ResWarn=*] [P.Stat=#PStatAuto#]

;-- #Rule: R1	 Results: P.Gr=D.R1.OK '+' P.Gr+1=RUN.CB2 // WRN: P.Gr=D.R1.WRN '+' P.Gr+1=RUN.CB2 // ON ERR: P.Gr=D.R1.ERR '+' P.Gr+1=X.P1 
[PStatKey=R1]
[RuleID=OK]      [O.Type=*] [J.ResCode=0]  [J.ResMsg=*] [J.ResMsgExt=*] [J.ResWarn=0] [P.Stat=#PStatAuto#] [P+1.Stat=RUN.CB2]
[RuleID=WRN]     [O.Type=*] [J.ResCode=0]  [J.ResMsg=*] [J.ResMsgExt=*] [J.ResWarn=1] [P.Stat=#PStatAuto#] [P+1.Stat=RUN.CB2]
[RuleID=ERR]     [O.Type=*] [J.ResCode<>0] [J.ResMsg=*] [J.ResMsgExt=*] [J.ResWarn=*] [P.Stat=#PStatAuto#] [P+1.Stat=X.P1]
