LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
Glenn Boyce
- Posts: 137
- Joined: Thu Jul 24, 2008 11:22 pm
Post
by Glenn Boyce » Sun Jul 19, 2009 11:11 pm
I've looked at this line and can't figure out why it won't work. Syntax problem of some kind but no doubt someone will see what I can't! I have it in a repeat loop and it just errors. Appreciate any help
Code: Select all
add item 7 of line n of fld "resultByMaterial" to gmatweight
-
SparkOut
- Posts: 2947
- Joined: Sun Sep 23, 2007 4:58 pm
Post
by SparkOut » Sun Jul 19, 2009 11:16 pm
What's the error you get? Is it on every iteration through the loop. At first glance I can't see why you'd get an error, so I think the only thing you can do is check your data (are you trying to add a non numeric value to the integer in gmatweight? have you got any dirty data with nulls or spaces that are causing the problem?) and step through the code in the debugger checking what values are being read and added.
EDIT: this is a line in a table field, presumably tab delimited, so have you set the item delimiter to tab in your routine before reading the values in the loop? theItemDelimiter resets itself back to the default value of comma at the end of each handler, so you may need to explicitly set it in this handler again if you had already changed it in another handler and thought that would be remembered.
-
Glenn Boyce
- Posts: 137
- Joined: Thu Jul 24, 2008 11:22 pm
Post
by Glenn Boyce » Sun Jul 19, 2009 11:44 pm
One of the numbers has a comma in it i.e. 5,000.00 and its obviously reading it as text.
-
shadowslash
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
-
Contact:
Post
by shadowslash » Mon Jul 20, 2009 2:59 pm
Glenn Boyce wrote:One of the numbers has a comma in it i.e. 5,000.00 and its obviously reading it as text.
Yep that's right. Therefore you must come up with a solution that will convert 5,000.00 to an integer. You may want to try a code somehow like this.
replace comma with empty in myVariable
Parañaque, Philippines
