Expression - Evaluate - Very Urgent
-
Hi, I am taking some formula expression from database, after i have to eveluate the expression into VALUE. the Expression as like as below, 1) BASIC + HRA + DA 2) 3000 + ABS(2000) + Round(Basic) 3) BASIC + iif((BASIC > 1000), 2000, 1000) + 3000 The Above are Formula expression already comming from database. i copied these expression to a string varable, then i am trying to evaluate all the mathematical expression like ROUND, ABS are giving value but IIF is not returns value ...So how to resolve this Expression... I am clearly mentioned my problem,.. if any clarification necessary plz dont hesitate to ask ..i will tell more clearly.. regards,
kannak
-
Hi, I am taking some formula expression from database, after i have to eveluate the expression into VALUE. the Expression as like as below, 1) BASIC + HRA + DA 2) 3000 + ABS(2000) + Round(Basic) 3) BASIC + iif((BASIC > 1000), 2000, 1000) + 3000 The Above are Formula expression already comming from database. i copied these expression to a string varable, then i am trying to evaluate all the mathematical expression like ROUND, ABS are giving value but IIF is not returns value ...So how to resolve this Expression... I am clearly mentioned my problem,.. if any clarification necessary plz dont hesitate to ask ..i will tell more clearly.. regards,
kannak
Marking your post as Very Urgent is very rude around here. It may be urgent to you but everyone here volunteers their time, it's not urgent to them
only two letters away from being an asset
-
Hi, I am taking some formula expression from database, after i have to eveluate the expression into VALUE. the Expression as like as below, 1) BASIC + HRA + DA 2) 3000 + ABS(2000) + Round(Basic) 3) BASIC + iif((BASIC > 1000), 2000, 1000) + 3000 The Above are Formula expression already comming from database. i copied these expression to a string varable, then i am trying to evaluate all the mathematical expression like ROUND, ABS are giving value but IIF is not returns value ...So how to resolve this Expression... I am clearly mentioned my problem,.. if any clarification necessary plz dont hesitate to ask ..i will tell more clearly.. regards,
kannak
Kannak, You menitioned that ROUND,ABS etc you are able to do. So you know the meaning of string "ABS" is the mathematical expression ABS. So you should be knowing the meaning of string "IIF". Based on the meaning you have to implement. Supposr, I think the meaning is the maximum of the 3 values then I would have a function like this -
/// <summary>
/// This method returns the max of the 3 values
/// </summary>
/// <param name="iifCond">Pass a string like this - "1000,2000,1500"</param>
/// <returns></returns>
private int GetValueFromIIF(string iifCond)
{
string[] strValues = iifCond.Split(',');
int[] intValues = new int[3];
int maxValue = -1;
for(int i = 0; i < strValues.Length;i++)
{
intValues[i] = Convert.ToInt32(strValues[i]);
if (intValues[i] > maxValue)
maxValue = intValues[i];
}
return maxValue;
}Regards, Arindam Sinha MyBlog - http://arindamsinha.wordpress.com/ Please give your feedback on this answer.
-
Hi, I am taking some formula expression from database, after i have to eveluate the expression into VALUE. the Expression as like as below, 1) BASIC + HRA + DA 2) 3000 + ABS(2000) + Round(Basic) 3) BASIC + iif((BASIC > 1000), 2000, 1000) + 3000 The Above are Formula expression already comming from database. i copied these expression to a string varable, then i am trying to evaluate all the mathematical expression like ROUND, ABS are giving value but IIF is not returns value ...So how to resolve this Expression... I am clearly mentioned my problem,.. if any clarification necessary plz dont hesitate to ask ..i will tell more clearly.. regards,
kannak