Rule Composer: Verify if value EXISTS in DB column
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > BizTalk Server > BizTalk Server General > Rule Composer: Verify if value EXISTS in DB column




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Rule Composer: Verify if value EXISTS in DB column  
Andre Afonso


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-22-05 10:50 PM

Hello,

I need some guidance building a rule that would behave like a SQL EXISTS
predicate, i.e. that would iterate trought the values of a database column
and stop on the first equal value found.

Now, in Rule Composer there's the "exists" predicate for rule conditions,
but this one works only for XML documents and my data source is a sql
database. So this won't do.

The other option is to use the "equal" predicate. Using this the rule
searches the column for a equal value, but the issue with this predicate is
that it considers every record in the table, what is not intended and
degrades performance. And also it will cause the rule will fire more than
once if more than one equal value is found. I've tried to avoid this by
using the "halt" action, but that ends all rule processing, not just the
given rule, not letting other existing rules to fire.

Is there an easy way to accomplish the behavior of a SQL EXISTS predicate in
the given scenario?

Thank you,

Andre Afonso







[ Post a follow-up to this message ]



    Re: Rule Composer: Verify if value EXISTS in DB column  
Andre Afonso


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-22-05 10:50 PM

OK,

I've solved it by creating a class that implements a method that checks if
the value exists issuing an sql query "SET ROWCOUNT 1; SELECT * WHERE column
= value". The method returns the SqlDataReader.HasRows.

Then I call the method in the condition passing it the value to check for
existence.

Don't forget to create a variable of the class type in the "scope" of the
"call rule shape" usign the "orchestration view".

Andre Afonso

"Andre Afonso" <andre.afonso@tekever.com.no.spam> wrote in message
news:ejXcwHQGFHA.4088@TK2MSFTNGP09.phx.gbl...
> Hello,
>
> I need some guidance building a rule that would behave like a SQL EXISTS
> predicate, i.e. that would iterate trought the values of a database column
> and stop on the first equal value found.
>
> Now, in Rule Composer there's the "exists" predicate for rule conditions,
> but this one works only for XML documents and my data source is a sql
> database. So this won't do.
>
> The other option is to use the "equal" predicate. Using this the rule
> searches the column for a equal value, but the issue with this predicate
is
> that it considers every record in the table, what is not intended and
> degrades performance. And also it will cause the rule will fire more than
> once if more than one equal value is found. I've tried to avoid this by
> using the "halt" action, but that ends all rule processing, not just the
> given rule, not letting other existing rules to fire.
>
> Is there an easy way to accomplish the behavior of a SQL EXISTS predicate
in
> the given scenario?
>
> Thank you,
>
> Andre Afonso
>
>







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:21 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register