Normal Topic Sesame 1.X Totalling a String (Read 364 times)
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Sesame 1.X Totalling a String
Feb 17th, 2011 at 3:47am
Print Post Print Post  
Hi guys,

I've bashed this out a few times, and I know I'm making a simple mistake.  Can someone help me?

I have pulled a string of values by @xlookupall ... it's returning a string array of dollar values, and putting them into a defined array.  But when I want to sum that array, I get everything conjoined, not summed.

Here's my code:

Code
Select All
var vCount as Int
var vListed as string
var vListTotal as String
var loop as int

vListed = @xlookupall(@FN,CltNo, "DR Screen!DBCltNo", ("DBList"))
vCount = @CountStringArray(vListed)

Loop = 1
vListTotal = 0

While Loop <= vCount
{
	vListTotal = vListTotal + @ToNumber(@AccessStringArray(vListed, Loop))
	Loop = Loop + 1
}

WriteLn(vCount)
WriteLn(vListed)
WriteLn(vListTotal)
 



And here's my WriteLn result:

Code
Select All
9
4950.000000;11329.370000;14264.220000;4287.510000;10340.600000;10731.010000;10459.080000;8797.380000;12567.450000
0495011329.3714264.224287.5110340.610731.0110459.088797.3812567.45
 

  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Sesame 1.X Totalling a String
Reply #1 - Feb 17th, 2011 at 6:07am
Print Post Print Post  
The vListTotal variable needs to be set as a Double or Money type, not String.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged