|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Evaluating a condition in a stringI 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 Hi,
Looks to me like you'll could try using DataTable.Select statement using a valid expression (see DataColumn.Expression). -- Show quoteMiha 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 Thanks a lot, got the pointer..
-- Show quoteSatya "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 > > > |
|||||||||||||||||||||||