Page 1 of 1
More on number formatting problems
Posted: Tue Jul 28, 2009 4:49 am
by Ron Zellner
I have a repeat loop that creates an array with this line inside it
Code: Select all
put round(item 7 of line i of field 1,0) & return before tClose2
Then this line is used below the loop:
Code: Select all
put max (tClose2) into field "Scale"
But it results with this error:
button "Calculate": execution error at line n/a (Function: is not a number) near "43"
How do I convert it to a number? Or calculate it differently?
Posted: Tue Jul 28, 2009 9:04 am
by espais
Without see more code, I think that some value, like decimal symbols can produce an error. Check it step by step with a breakpoint inside the loop and see what values are processing.
Salut,
Josep
Posted: Tue Jul 28, 2009 9:44 am
by SparkOut
Also check for the item in question having no extra whitespace input in the original field, which would make it interpreted as a string, not a number.
Posted: Tue Jul 28, 2009 3:30 pm
by FourthWorld
Is the field named "1,0"? If so, try putting that name in quotes (a good habit with all string literals):
put round(item 7 of line i of field "1,0") & "," before tClose2
I've also changed the return to a comma because the max function expects a comma-delimited list.
Yes, commas, not lines
Posted: Tue Jul 28, 2009 7:09 pm
by Ron Zellner
That's what I ended up doing-
Code: Select all
put round(item 7 of line i of field "MainData",1) &"," after Temp
I had been trying to get the max from the lines in the field and switched to using comma delimited data in a variable. I didn't know that max & min didn't work on lines.
The full code is in my reply to the previous posting: "revMedia ALPHA .. Financial Chart script".
I also changed the name of the data field from "1" to "MainData" to avoid confusion or error.