| Madhur Joshi 2006-08-18, 1:18 am |
| I've pasted some sample vbs code below.
It uses the expression evaluation engine along with arbitrary dictionaries.
You can easily translate it into equivalent .Net code.
Hope that helps,
madhur
set evaluator = CreateObject("Commerce.ExpressionEvaluator")
sExpr = "<CLAUSE OPER='less-than'>" & _
"<PROPERTY ID='my.age' TYPE='number' MULTIVAL='false'/>"& _
"<IMMED-VAL TYPE='number'>21</IMMED-VAL>" & _
"</CLAUSE>"
set mainDict = CreateObject("Commerce.Dictionary")
' will return null because the result is undefined
WSCRIPT.Echo evaluator.EvalXML( sExpr, mainDict)
set myDict = CreateObject("Commerce.Dictionary")
' you can add more dictionaries if you want to target somthing besides my
set mainDict("my") = myDict
myDict("age") = 20
' will return true because my age is less than 21
WSCRIPT.Echo evaluator.EvalXML( sExpr, mainDict)
myDict("age") = 25
' will return false because my age is greater than 21
WSCRIPT.Echo evaluator.EvalXML( sExpr, mainDict)
Thanks,
madhur
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2002 Microsoft Corporation.
All rights reserved.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Please reply to the newsgroups only.
--------------------
From: "J.F. Larente" <jflarente@cactus.ca>
Subject: Extending the EEE
Date: Mon, 10 Jul 2006 15:36:46 -0400
Does anyone have sample code for using the Expression Evaluator Engine
outside of the CSF pipeline context?
We're trying to use it to evaluate some custom rules and have never used it
before in that capacity.
Thanks!
J.F.
|