I have a cell in an excel sheet that i am trying to read.
When I use the function getCalculatedValue it's throwing following error:
Financials!LU83 -> Financials!LU81 -> Formula Error: An unexpected error occured
I wrote following function to read from a cell
private function getCellValue($data)
{
//example of data variable
//$data = [0, 'G79'];
$excel = $this->excel;
$excel->setActiveSheetIndex($data[0]);
\PHPExcel_Calculation::getInstance($excel)->flushInstance();
\PHPExcel_Calculation::getInstance($excel)->clearCalculationCache();
return $excel->getActiveSheet()->getCell($data[1])->getCalculatedValue();
}
that cell that I am trying to read has following value
=LU83+LT84
where LU83 has following value
=LU73-SUM(LU76:LU81)
LU81 has value
=VLOOKUP(LU8,'Wiser Return'!$O:$S,5,0)
I have no idea why I am getting this error. I wish there was a way to debug? Is there a way?
Any help is appreciated.
Thanks
The problem is that PHPExcel's calculation engine does not fully support row or column ranges.
=VLOOKUP(LU8,'Wiser Return'!$O:$S,5,0)
contains the column range $O:$S
If this can be converted to a cell range instead, e.g
=VLOOKUP(LU8,'Wiser Return'!$O1:$S1024,5,0)
then it should handle the formula correctly
I can't comment now, but I found some link that might help you.
In this question the accepted answer states, that you can get further information about the error with this gist.
(I suggest deleting your question if this helped you.)
I've got a JSON variable ($epoch) which contains the date in epoch (1370777177), and I'd like to convert it to the following format and output it:
date "+%F %R" -ud #1370777177
which returns:
2013-06-09 11:26
So I figure using php to echo the command is one way to do it. Is there a way to convert the epoch to the format above and append it to a DIV using JS? That might be a lot easier. I've tried creating a PHP variable which encodes the JSON var:
$date = json_encode($epoch);
echo exec ('date "+%F %R" -ud #%date');
But that doesn't work.
echo json_encode($epoch)
returns 'null'. The JSON variable is in a external .js file.
Is there a way to convert the epoch to the format above and append it to a DIV using JS?
Yes, there is.
Also exec() will scale awesomely.
So I found some answers on how to do this, but none of them actually worked, i.e. json_decode(). This is what I did:
I created js object/array
Then I passed it to php file via Ext.Ajax.Request as JSON.stringify(js object)
Now in my php I see the result of that string as follows: ["James;","George;"]
I want to get it as an php array like (James, George). Any easy way to do this or I have to remove unnecessary parts manually?
OK, I was looking at this problem for a while and finally got the answer.
Inside php, I needed to add json_decode(stripslashes($scenarios)), where $scenarios = ["James;","George;"].
Code: ($scenarios is sent from js file via Ajax using JSON.stringify(js object))
<?php
$scenarios = empty($_GET['scenarios']) ? false : $_GET['scenarios'];
// more code for validation
$arr = json_decode(stripslashes($scenarios));
?>
Now $arr will become regular php array.
Use html_entity_decode function
i have a variable in flash that takes its value from a php file using the print function.
The variable is not returning the correct value. It's returning "undefined". I have checked of both flash and php source code for errors, they both seem the be fine.
anyone know what could be causing this?
php print code:
print "return_sponsor=$sponsor";
flash code:
function completeHandler(event:Event):void{
// Clear the form fields
name_txt.text = "";
email_txt.text = "";
MovieClip(parent).gotoAndPlay("finish");
// Load the response from the PHP file
variables.sponny = event.target.data.return_sponsor;
I've not used AS3 in a while, but this might work.
Replace:
variables.sponny = event.target.data.return_sponsor;
With:
var data:URLVariables = new URLVariables(event.target.data);
variables.sponny = data.return_sponsor;
I don't know what type your sponny variable is but that error is generally returned when Flash can't convert types correctly. It happens to me if I am trying to convert a string to a Number or int (or some other numeric type) and there is a non-numeric symbol in the string (so "12a4" would not be able to convert properly for example).
When you are debugging, place event.target.data.return_sponsor in a String variable and check that it is the correct data. If you can't debug, you may have to find a way to show the data on the screen somehow (maybe by printing them to the form?)
name_txt.text = event.target.data.return_sponsor;
I have a some data in JSON format(which comes from php) to be passed to a javascript function. I'm getting 'invalid property id' error when I try to do this.
Error: invalid property id
Source File: http://localhost/MathVoyager/index.php/test
Line: 1, Column: 15
Source Code:
draw_quadratic({
Below is the js function signature(both data and options are in JSON format)
function draw_quadratic(data, options, alpha, beta)
Below is a sample function call.
draw_quadratic({"label":"(((1)*x^((1))+(4))*((1)*x^((1))+(6))) = (0)","data":[[-8,8],[-7.5,5.25],[-7,3],[-6.5,1.25],[-6,0],[-5.5,-0.75],[-5,-1],[-4.5,-0.75],[-4,0],[-3.5,1.25],[-3,3],[-2.5,5.25],[-2,8]],"xaxis":1,"yaxis":1}, {"series":{"points":{"show":true},"lines":{"show":true}},"grid":{"hoverable":true,"clickable":true}}, 4, 8);
(I'm trying to plot some graph using flot js library)
Thanks in advance
mydata= JSON.parse('{"label":"(((1)*x^((1))+(4))*((1)*x^((1))+(6))) = (0)","data":[[-8,8],[-7.5,5.25],[-7,3],[-6.5,1.25],[-6,0],[-5.5,-0.75],[-5,-1],[-4.5,-0.75],[-4,0],[-3.5,1.25],[-3,3],[-2.5,5.25],[-2,8]],"xaxis":1,"yaxis":1}');
myoptions= JSON.parse('{"series":{"points":{"show":true},"lines":{"show":true}},"grid":{"hoverable":true,"clickable":true}}');
draw_quadratic( mydata,myoptions,4,8);
Don't forget '' or "" when sending parameters to jsonparse it takes a string
www.JSON.org/json2.js
www.JSON.org/js.html
In php you can use:
.json_decode — Decodes a JSON string
.json_encode — Returns the JSON representation of a value
The code I wrote works with me in Chrome.