We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Logical Expression IF with -ve values

Thread ID:

Created:

Updated:

Platform:

Replies:

31570 Jul 10,2005 11:35 PM Jul 14,2005 07:17 PM Windows Forms 7
loading
Tags: Calculate
Simon Fielke
Asked On July 10, 2005 11:35 PM

When the Logical Expression "IF" is used with a negative value (passed to the ParseAndComputeFormula method of the calengine), I get an "invalid expression" returned. I am doing something wrong here - the formulas a shown below: formula = "-1.10*4";//returns -4.4 formula = "IF(2 < 3, 1.10*4, 0)"; //returns 4.4 formula = "IF(2 < 3, -1.10*4, 0)"; //returns "invalid expression" Thank you, Simon

Administrator [Syncfusion]
Replied On July 11, 2005 04:37 AM

This is a defect that we will correct. Until there is a version released with this corrected, adding parentheses avoids the problem. formula = "IF(2 < 3, (-1.10*4), 0)"; This is logged as defect #480. http://www.syncfusion.com/support/issues/calculate/Default.aspx?ToDo=view&questId=480

Byron Tate
Replied On July 13, 2005 12:36 PM

I also see a problem that requires parentheses to correct: using GridFormulaEngine in a DataBoundGrid, I add this NamedRange to the engine: engine.AddNamedRange("X","if(true,(a0),b0)"); where a0 and b0 are the zero-reference form used with the engine.CurrentRowNotationEnabled = true; setting. In the above case, the cell value of a0 is put in the "FormulaCell" cell which contains "=X". But if I change the expression like this: engine.AddNamedRange("X","if(false,(a0),b0)"); I get the column header string for column B in the "FormulaCell" cell, instead of column B''s cell value for that row. So it looks like cell reference must be part of an expression to get interpreted correctly. Now, here''s my real problem: I have a mission-critical deployment due Sept 1. Do you have a bug-fix patch coming out soon? I will get beat up if I require my end users to enter parentheses to fix this bug.

Byron Tate
Replied On July 13, 2005 12:59 PM

another case that I really need to work with GridFormulaEngine in GridDataBoundGrid: engine.AddNamedRange("Col1","A0"); engine.AddNamedRange("Col2","b0"); engine.AddNamedRange("X","if(true,Col1+Col2,b0)"); The ''Col1+Col2'' is not recognized as an expr. If a0 and b0 are substituted for Col1 and Col2, it works. But ''if(true,(Col1+Col2),b0)'' works.

Administrator [Syncfusion]
Replied On July 13, 2005 01:50 PM

I can see the behavior you described. As soon as we have researched the problem, I will update this thread.

Administrator [Syncfusion]
Replied On July 14, 2005 08:03 AM

This has been entered as defect #489, and has been corrected in our code base. It will be part of the 3.3 release that should be public shortly (a matter of days, not years). When you put parentheses around an argument in a Function call, then that arguments gets parsed early in the processing of the formula. It is this call to the parse routine that makes the CurrentCellNotation substitutions, and allows things to work. But instead of forcing this early parsing all the time to correct this problem, we added a property that will allow you to turn this on. GridFormulaEngine.ForceParsingOfLibraryFunctionArguments=true will force all function arguments to be parsed at a point where the engine can properly substitute the current row as required by the CurrentRowNotationsEnabled property.

Byron Tate
Replied On July 14, 2005 01:30 PM

thanks. I''ll be eagerly waiting for the release. You must have reasons why you wanted to fix this with a flag setting. I can''t imagine anyone understanding the syntax well enough to figure out how to avoid this problem without the flag turned on.

Administrator [Syncfusion]
Replied On July 14, 2005 07:17 PM

If you are not using Namedranges or CurrentCellNotation, it adds addition overhead that is not needed. Another consideration is that this would be a possible change that would make existing code behave differently. In such cases, adding a property to turn this on might avoid backward compatibility problems.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;