IRuleApiEvalT Method (String, String, RuleParameter) |
Namespace: Casewhere.Runtime.DSL.Api
T Eval<T>( string ruleCacheKey, string ruleExpression, params RuleParameter[] parameters )
var ruleApi = ctx.Use<IRuleApi>(); var dataApi = ctx.Use<IDataApi>(); var employee = dataApi.Load("CwUatEmployee/c83fe344-3ee6-4951-90e7-adfe006584ba"); var query = DataObjectApiQuery.For("CwUatEmployee").FilterBy(FilterBuilder.Create().Build()); query.Take = 10; var queryResult = dataApi.Search(query); var ruleParameters = new List<RuleParameter>() { new DataObjectRuleParameter("dataObj", employee), new ScalarRuleParameter("number", " 12"), new DataObjectListRuleParameter("dataObjList", queryResult.Data) }; var result = ruleApi.Eval<string>( "DynamicRuleKey", @"#predicate var obj1Names = dataObjList.Where(w => w.JobTitle == ""Recruiter"").Select(s => s.Name); return dataObj.Name + number + "" names: "" + string.Join("","", obj1Names) ; ", ruleParameters.ToArray() );