Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to put Minimum Value of (cpKL,cpKR) into cpK How to write the expression for cpK


sigma.Expression = "(Convert(point90,'System.Double')-Convert(point10,'System.Double'))/2.56";

cpKL.Expression = "(Convert(point50,'System.Double')- Convert(LSL,'System.Double'))/(3.0*sigma)";

cpKR.Expression = "(Convert(USL,'System.Double') - Convert(point50,'System.Double'))/(3.0*sigma)";

// The expression contains undefined function call Math.Min().
//cpK.Expression = "Math.Min((Convert(cpKL,'System.Double'),(Convert(cpKR,'System.Double'))";
Posted
Updated 12-Mar-14 0:35am
v2
Comments
BillWoodruff 13-Mar-14 2:51am    
Are you actually wanting to save string representations of executable code which you will want to execute later ? If so, you need to study the 'Action and 'Func facilities in .NET FrameWork 3.5 and later, or study the use of Delegates in earlier versions of .NET.

cpK.Expression = "IIF(cpKL < cpKR, cpKL, cpKR)";
 
Share this answer
 
Try this,

C#
cpK.Expression = (cpKL<cpkr)?cpkl:cpkr;>
 
Share this answer
 
then try separately, like this,

first check which is smaller and assign that to a 3rd variable say cp,


C#
if(cpKL < cpKR)
{
   cp = cpKL;
}
else cp = cpKR;

Now assign cpK.Expression = cp;
 
Share this answer
 
Comments
CHill60 12-Mar-14 9:10am    
Please don't post multiple solutions like this. It is very hard to follow. Either use the Reply link next to the OP's comments or use "Improve solution" to add detail to your original solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900