Home All Groups Group Topic Archive Search About

Evaluating a condition in a string

Author
24 Apr 2006 7:27 AM
Satya
Hi All,

I have a scenario as below.

I have a data row like

AcctNum    CheckNum    Amt    Payee        Date
9999999    125699    10370.25    ABCD...XYZ    04/24/06

Now I have to process this row basing on a condition.

if (<Condition>)
    //Process The row
else
    continue;

The complexity here is, <Condition> comes from a configuration file, like
length of payee > 40 (_dataRow["Payee"].ToString().Length > 40) and Amt >
50000.00 etc...
But this expression comes as a string which i have to evalute to true or
false.

This condition varies from bank to bank and will be maintained in a config
file.

Is there any way to achieve this? Or is there any different approach to
solve this?

Thanks in advance
--
Satya

Author
24 Apr 2006 10:03 AM
Miha Markic [MVP C#]
Hi,

Looks to me like you'll could try using DataTable.Select statement using a
valid expression (see DataColumn.Expression).

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Show quote
"Satya" <Sa***@discussions.microsoft.com> wrote in message
news:CF9207EE-7BBB-4E64-ACE3-F3ADFBF10EAD@microsoft.com...
> Hi All,
>
> I have a scenario as below.
>
> I have a data row like
>
> AcctNum CheckNum Amt Payee Date
> 9999999 125699 10370.25 ABCD...XYZ 04/24/06
>
> Now I have to process this row basing on a condition.
>
> if (<Condition>)
> //Process The row
> else
> continue;
>
> The complexity here is, <Condition> comes from a configuration file, like
> length of payee > 40 (_dataRow["Payee"].ToString().Length > 40) and Amt >
> 50000.00 etc...
> But this expression comes as a string which i have to evalute to true or
> false.
>
> This condition varies from bank to bank and will be maintained in a config
> file.
>
> Is there any way to achieve this? Or is there any different approach to
> solve this?
>
> Thanks in advance
> --
> Satya
Author
24 Apr 2006 12:12 PM
Satya
Thanks a lot, got the pointer..


--
Satya


Show quote
"Miha Markic [MVP C#]" wrote:

> Hi,
>
> Looks to me like you'll could try using DataTable.Select statement using a
> valid expression (see DataColumn.Expression).
>
> --
> Miha Markic [MVP C#]
> RightHand .NET consulting & development www.rthand.com
> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>
> "Satya" <Sa***@discussions.microsoft.com> wrote in message
> news:CF9207EE-7BBB-4E64-ACE3-F3ADFBF10EAD@microsoft.com...
> > Hi All,
> >
> > I have a scenario as below.
> >
> > I have a data row like
> >
> > AcctNum CheckNum Amt Payee Date
> > 9999999 125699 10370.25 ABCD...XYZ 04/24/06
> >
> > Now I have to process this row basing on a condition.
> >
> > if (<Condition>)
> > //Process The row
> > else
> > continue;
> >
> > The complexity here is, <Condition> comes from a configuration file, like
> > length of payee > 40 (_dataRow["Payee"].ToString().Length > 40) and Amt >
> > 50000.00 etc...
> > But this expression comes as a string which i have to evalute to true or
> > false.
> >
> > This condition varies from bank to bank and will be maintained in a config
> > file.
> >
> > Is there any way to achieve this? Or is there any different approach to
> > solve this?
> >
> > Thanks in advance
> > --
> > Satya
>
>
>

AddThis Social Bookmark Button