So vMileList is a list of numbers in parens

SET VAR vCounter INTEGER = 0
SET VAR vGetNumT TEXT = NULL
SET VAR vGetNum INTEGER = NULL
SET VAR vTotalNum INTEGER = 0
WHILE #PI <> 0 THEN
  -- Increase counter by 1
  SET VAR vCounter = (.vCounter+1)
  -- Pull out numbers from list, 1 at a time
  SET VAR vGetNumT = (SSUB(.vMileList,.vCounter))
  -- If no value, no more numbers to pull: end loop
  IF vGetNumT IS NULL THEN
     BREAK
  ENDIF
  -- Convert number pulled out from text to integer
  SET VAR vGetNum = (INT(.vGetNumT))
  -- Add to grand total
  SET VAR vTotalNum = (.vTotalNum + .vGetNum)
ENDWHILE

vTotalNum will be the grand total



David Blocker
[EMAIL PROTECTED]
781-784-1919
Fax: 781-784-1860
Cell: 339-206-0261
----- Original Message -----
From: "Claudine Robbins" <[EMAIL PROTECTED]>
To: "RBG7-L Mailing List" <[email protected]>
Sent: Saturday, July 02, 2005 7:11 PM
Subject: [RBG7-L] - Choose problem


> Hi everyone,
>
> I have a simple goal:
>
> 01. Pick two or more choices from a view, return integer values strung
along
> in a text variable
>
> 02. Somehow transform the values inside the variable back into integers
and
> add them up
>
> So far, this is what I have:
>
> CHOOSE vmilelist FROM #VALUES FOR DISTINCT (loc_desc &
> (ctxt(plusminus))),plusminus +
> FROM v_plusminus +
> WHERE active_fl_28 = 'Y' +
> ORDER BY loc_desc +
> CHKBOX 0 +
> TITLE 'Add Mileage' +
> CAPTION 'LOCATIONS PLUS MINUS MILES' +
> LINES 25 +
> FORMATTED
> SET VAR  vmilelist = ('(' + .vmilelist + ')')
>
> My choose looks like this:
>
> DULAC-LA 3     <===
> REDDELL-LA 8
> MAMOU-LA 11
> FRANKLIN-TX 5  <===
>
> The value returned is 3 and 5 and the text variable vmilelist looks like
> this: (3,5)
>
> The result I want is integer 8, i.e. the sum of 3 and 5.
>
> Can I get there from here?
>
> TIA,
>
> Claudine :)
>
> --- RBG7-L
> ================================================
> TO POST A MESSAGE TO ALL MEMBERS:
> Send a plain text email to [email protected]
>
> (Don't use any of these words as your Subject:
> INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
> REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
> ================================================
> TO SEE MESSAGE POSTING GUIDELINES:
> Send a plain text email to [email protected]
> In the message SUBJECT, put just one word: INTRO
> ================================================
> TO UNSUBSCRIBE:
> Send a plain text email to [email protected]
> In the message SUBJECT, put just one word: UNSUBSCRIBE
> ================================================
> TO SEARCH ARCHIVES:
> Send a plain text email to [email protected]
> In the message SUBJECT, put just one word: SEARCH-n
> (where n is the number of days). In the message body,
> place any
> text to search for.
> ================================================
>
>
>

Reply via email to