scaleTo in cfchart not working - coldfusion

I am working on ColdFusion 9 - cfchart,
Here is part of my code
<cfchart format="flash" show3d="true" title="Assigned Amount vs Projection Amount" scaleto="#scaleToForAmount#" scaleFrom="0" backgroundColor="white" font="Arial" seriesplacement="stacked" chartHeight="400" chartWidth="800" labelFormat="number" >
<cfchartseries type="bar" query="chartData" itemcolumn="#variables.columnList[1]#Name" valuecolumn="PAID" seriesColor="##155D7F" seriesLabel="amout" paintStyle="plain" >
</cfchartseries>
<cfchartseries type="bar" query="chartData" itemcolumn="#variables.columnList[1]#Name" valuecolumn="PTP" seriesColor="##2AB9FF" paintStyle="plan" seriesLabel="PTP" >
</cfchartseries>
<cfchartseries type="bar" query="chartData" itemcolumn="#variables.columnList[1]#Name" valuecolumn="PDC" seriesColor="##0A2E40" paintStyle="domain" seriesLabel="PDC" >
</cfchartseries>
But i am getting problem when value of scaleTo Increase beyond integer limit it show error. Even when converting it to string, double or bigInt it is not accepting those values. And continue to show error that "Cannot convert the value 3.1616321275E9 to an integer because it cannot fit inside an integer". Can anyone help me to get out of this.

You are passing a float value to scaleTo attribute. The scaleTo attribute expects an integer value.
I will also suggest not to use flash format for chart. The flash format has been depricated in the newer version of CF. It will throw an error if your code is migrated to the newer version of CF.
Update:
ColdFusion supports integers between -2,147,483,648 and 2,147,483,647 (32-bit signed integers). You can assign a value outside this range to a variable. ColdFusion initially stores the number as a string. If you use it in an arithmetic expression or operation related to number, ColdFusion converts it into a floating-point value, preserving its value, but losing precision. The value 3161632127 is out of range. Hence CF is converting the value to the float. And since the value is float, CF is throwing an error. Check out the document.

Related

Google sheet - IF formula is not working properly?

Image of the problem (https://i.stack.imgur.com/Ie0ZV.png)
The IF formula is supposed to give the answer yes if the two values are the same, which they are. Although I get the answer No. Why is this happening?
The two values are themselves formulas from other sheets.
Image of attempt to solve (https://i.stack.imgur.com/qetL3.png)
I tried to use numbers directly put in the same sheet (no numbers coming from a formula), and then it works. But I need to use values that are based on formulas taking numbers from other sheets.
while the values derived from the formulas is just showcasing 2 decimal places, its likely that when you expand/increase the decimals to extreme end there could be a possible difference (alike the one you can see in the screenshot for reference; the EXACT() in Cell B3 throws 'FALSE')
You could ROUND() them up for exact match scenario.

ColdFusion 9 set decimal type for cfqueryparam?

I have few form fields where user can enter whole numbers, decimal numbers and both types can be positive or negative. In other words they can enter something like this:
1 or 0.9 or 5.6745 or -10 or -0.9 or -10.5435
I'm wondering what I should use in my cfqueryparam on cfsqltype? I tried decimal but looks like that is not supported in ColdFusion 9. Is there any other option or I should use varchar?
Use the option that matches the column in your database. By selecting the correct value, Coldfusion will try to validate and format the value before it is sent off to the database driver.
With fix precision types cf_sql_numeric and cf_sql_decimal you need to also specify the scale (number of decimal places) your column accepts. By default the scale is 0, and will only store an integer number. Once again check your database for the scale.
For non precision types such as cf_sql_float no scale should be specified and the full value is sent off to the database.
Full list of data types can be found in the Adobes docs.

Easy way to check ColdFusion range then select a value if outside of that range

I'm new to ColdFusion, and I came across some legacy code that wasn't checking a GET parameter for a number. I'm trying to add some code similar to:
<cfparam name="URL.count"
default="5"
min="1" max="9999"
type="range">
Such that nobody can just add arbitrary values like 50,000 or -1. I thought, that ColdFusion would use the specified default value if it was outside that range, but instead it appears to throw an exception and use the default only when nothing is specified.
I can try/catch the exception, but I was wondering, since I'm new to this, if there wasn't a better practice in ColdFusion for handling a situation like that. Perhaps there is another ColdFusion tag I don't know about—that sorta thing.
The practice for handling this in ColdFusion is the same as it is in any language - if/else.
if (url.count <= 99999) {
code for good count
}
else {
code for bad count
}
Now, since this is a url variable, it might be the case where you have control over that as well. If it's coming from a form method="get", you can add some client side validation to augment, not replace the server side validation shown above.
Similarly, if it's coming from an anchor tag or cflocation tag that you generated, you can do something when generating that code to prevent the situation.
CFPARAM is just used to set a default value for a variable if it has not already been defined. While it can be used to validate the data type of a variable, it can't perform conditional logic related to values. You have to do that manually.
<cfparam name="URL.count" type="numeric" default="5">
<cfif (url.count LT 1) OR (url.count GT 9999)>
<cfthrow type="error" message="The current count (#url.count#) is outside of the allowed range.">
</cfif>
Combine Min and Max, like so. I'd be more verbose but I think it only makes it confusing. (minimum between maximum between and...)
Min(Max(lower_boundary,currentnumber),upperBoundary)
As a function, more readable,
<cfscript>
numeric function uForceRange(required numeric cNum, required numeric lNum, required numeric hNum) {
return Min(Max(arguments.lNum,arguments.cNum),arguments.hNum);
}
</cfscript>
<cfoutput><pre>Between 1 and 10:
7: #uForceRange(7,1,10)#
0: #uForceRange(0,1,10)#
42: #uForceRange(42,1,10)#
10.4: #uForceRange(10.4,1,10)#</pre></cfoutput>
This simple function is of course implemented just as easily in any language.

Sitecore multivariate testing: how are values calculated?

I've created a multivariate test, but the values are stuck at zero. To make these values go up in accordance with my users' behavior when they convert, I have to do something I haven't done yet, and no documentation I can find describes just what this is.
I've tried configuring a goal with a rule of "item ID is equal to (some goal page's item ID)" and set the points value to eg. 1 or 5. But when I visit the page in a browser, the values on my test stay stuck stubbornly on zero.
Is there something I'm not doing?
This is most likely caused by the Test Statistics cache. It is set by default to 1 hour expiration time. To see your results instantly simply change the setting in the web.config to:
<setting name="WebEdit.TestStatisticsCacheExpiration" value="00:00:00" />

Excel Formula Calculations

I'm trying to add a spreadsheet editing function in my iOS app. I am using a gridview to display (not relevant to the question) and I am using LibXL to load the data into the view. That part all works very well but I have no way to calculate the formulas after a cell has been modified.
It appears that when I write a formula with LibXL it is not calculating the new value, just setting the formula value (a string). So when I try to read the number value from that cell it is still set to the last computed number (from excel).
Likewise, if I create cells with numbers and a formula cell to SUM them, it is never actually computed which reads a 0 number value until it's opened in Excel.
I was hoping LibXL was the silver bullet to my problem, but now I'm stuck with just the formula string value (i.e. "SUM(A1:b2)" ) and the last computed value.
I would love it if LibXL simply DID compute values and I just have it all wrong, but I can't see any documentation that says otherwise. If that's not the case are there any Obj-C, C, or C++ libraries that I can use to match the Excel Formula syntax and compute these values?
Just adding my previous comment as an answer:
Dave Delong's DDMathParser has the option to add custom functions, check it out here: http://github.com/davedelong/DDMathParser