how to have access to the bpl set rules in programming
hi world, how can i have access to the BPL set rules in programming ?
for information: all logical rules are stored in routine data base, but i don't know how to have access to its corresponding name space.
thank you for helping
if you open BPL in Studio click here to switch to Class view
by program the code is found in class %Dictionary.XDataDefinition
Property Data holds your XData as Stream
http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?P...
to find the id you can use
select ID from %Dictionary.XDataDefinition where parent %startswith '<my class name>'
To programmatically access the raw BPL XML...
ENSDEMO>set xdata=##class(%Dictionary.XDataDefinition).%OpenId(className_"||BPL",.sc)
To then access the BPL data as objects...
ENSDEMO>set sc=parser.ParseStream(xdata.Data,.bpl)
E.g.
ENSDEMO>zw bpl
bpl=<OBJECT REFERENCE>[7@Ens.BPL.Process]
+----------------- general information ---------------
| oref value: 7
| class name: Ens.BPL.Process
| reference count: 4
+----------------- attribute values ------------------
| Component = ""
| ContextSuperClass = ""
| DerivedVersion = ""
| Height = 2000
| Includes = ""
| Language = "objectscript"
| Layout = ""
| Package = ""
| Request = "Demo.Loan.Msg.Application"
| Response = ""
| Version = ""
| Width = 2635
+----------------- swizzled references ---------------
| i%Context = ""
| r%Context = "8@Ens.BPL.Context"
| i%Parent = ""
| r%Parent = ""
| i%Sequence = ""
| r%Sequence = "17@Ens.BPL.Sequence"
+-----------------------------------------------------
ENSDEMO>set context=bpl.Context
ENSDEMO>zw context
context=<OBJECT REFERENCE>[8@Ens.BPL.Context]
+----------------- general information ---------------
| oref value: 8
| class name: Ens.BPL.Context
| reference count: 9
+----------------- attribute values ------------------
| (none)
+----------------- swizzled references ---------------
| i%Parent = ""
| r%Parent = "7@Ens.BPL.Process"
| i%Properties = ""
| r%Properties = "9@Ens.BPL.PropertyList"
+-----------------------------------------------------
Business Rule Definition is stored as XML in XData block named RuleDefinition inside rule class and can be (de)serialized as an object of Ens.Rule.Model.ruleDefinition class. Some utility methods are available there.
Here's an example of modifying Demo.ComplexMap.Rule.SemesterBatchRouting rule in ENSDEMO class. It modifies "when" condition from 1 to 0.
That said, I think the better approach would be to use (in order of
increasing implementation difficulty):
So the rule by itself does not change but values supplied by Context Class/Temporary Variables/etc do.