I need to set absolute value for the following expression
formula Dealt_sigma = |Mean_new - Mean_refrence| /(sigma)
delta_sigma cannot be negative.
Delta_sigma.Expression = "(Convert(mean_new,'System.Double')-Convert(Mean_refrence,'System.Double'))/(sigma)";
Loading


VulpesRank #55 · 29.2K reputationPosted Mar 19, 2014, 5:23 AM EDT
condition ? a : b
where 'condition' is a bool and 'a' and 'b' are values of the same type.
So, if condition is true, it returns 'a' and, if it's false, it returns 'b'.
Conceptually, it's simple enough though where you have complex expressions, you can drown in a sea of brackets if you're not careful!
Check this link for everything that's allowed in the Expression property:
http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression(v=vs.110).aspx
VulpesRank #55 · 29.2K reputationPosted Mar 19, 2014, 3:14 AM EDT
To enable me to come up with an answer, can you advise whether the 'sigma' column could be negative or zero?
Farhan ShariffRank #2,004 · 725 reputationPosted Mar 19, 2014, 3:42 AM EDT
VulpesRank #55 · 29.2K reputationPosted Mar 19, 2014, 3:48 AM EDT
So try this:
Delta_sigma.Expression = "IIF((Convert(Mean_new,'System.Double') - Convert(Mean_refrence,'System.Double')) >= 0.0, Convert(Mean_new,'System.Double') - Convert(Mean_refrence,'System.Double'), Convert(Mean_refrence,'System.Double') - Convert(Mean_new,'System.Double'))/sigma";
Farhan ShariffRank #2,004 · 725 reputationPosted Mar 19, 2014, 3:59 AM EDT
thanks_a_lot Vulpes