Dennis:

 

Bingo. Thanks very much. 

 

Recap: This resolves the confusion between the use of the variable NAME and
its VALUE

 

  --vGlSegment contains the name of the variable holding the value

  set var vTmp = ('.' + .vGlSegment)

  WRITE &vtmp

 

Bruce

 

From: [email protected] [mailto:[email protected]] On Behalf Of Dennis
McGrath
Sent: Sunday, June 23, 2013 8:10 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Routine writes out variable names, not values.

 

--file: cmd_glcode_breakdown.rmd

 

--rbse: global

 

--auth: bachitiea

 

--crea: 2013-0623

 

--Environment

 

SET TRACE ON

 

CLEAR VAR v%

 

--CLS

 

--Variables

 

SET VAR vGLCode TEXT = NULL

 

SET VAR vRoundingLevel INTEGER = -3

 

SET VAR vGLSegment TEXT = NULL

 

SET VAR vGLSegmentBody TEXT = 'vCOA'

 

SET VAR vGLSegmentLevel INTEGER = 1

 

--Value Entry

 

DIALOG 'Enter a four-digit GL Code' vGLCode =4 vendkey 1 +

 

  CAPTION 'Test Entry'

 

SET VAR vGLCode INTEGER

 

LABEL LoopEnter

 

--Indent

 

 

  SET VAR vGLSegment = (.vGLSegmentBody + (CTXT(.vGLSegmentLevel)))

 

  SET VAR &vGLSegment INTEGER = (RNDDOWN(.vGLCode,.vRoundingLevel))

 

 

  --vGlSegment contains the name of the variable holding the value

  set var vTmp = ('.' + .vGlSegment)

  WRITE &vtmp

 

  IF &vGLSegment = .vGLCode THEN

 

    GOTO LoopExit

 

  ELSE

 

    SET VAR vGLSegmentLevel = (.vGLSegmentLevel + 1)

 

    SET VAR vRoundingLevel = (.vRoundingLevel + 1)

 

    GOTO LoopEnter

 

  ENDIF

 

--Outdent

 

LABEL LoopExit

 

 

LABEL Exit

 

--CLEAR VAR v%

 

RETURN




Dennis McGrath
[email protected] <mailto:[email protected]> 
[email protected] <mailto:[email protected]> 

 

On Sun, Jun 23, 2013 at 6:41 PM, Bruce A. Chitiea <[email protected]
<mailto:[email protected]> > wrote:

All:

Following is a simple routine to take a four-digit GL Code (ex. 7512) and
extract GL nesting values into four target variables.

The target variable name vCOAx is a concatenation, allowing incrementing
with each loop.

Watch variables prove that the ampersanded variable assignment works:

vGLCode = 7512

vCOA1 = 7000

vCOA2 = 7500

vCOA3 = 7510

vCOA4 = 7512

But. The 'WRITE' statement, being a testing substitute for saving off the
values, write out the literal NAME of the variable, not its VALUE:

vCOA1

vCOA2

vCOA3

vCOA4

What am I missing that would write out the variable values, not the variable
names?

Thanks much

Bruce

--file: cmd_glcode_breakdown.rmd

--rbse: global

--auth: bachitiea

--crea: 2013-0623

--Environment

SET TRACE ON

CLEAR VAR v%

--CLS

--Variables

SET VAR vGLCode TEXT = NULL

SET VAR vRoundingLevel INTEGER = -3

SET VAR vGLSegment TEXT = NULL

SET VAR vGLSegmentBody TEXT = 'vCOA'

SET VAR vGLSegmentLevel INTEGER = 1

--Value Entry

DIALOG 'Enter a four-digit GL Code' vGLCode =4 vendkey 1 +

  CAPTION 'Test Entry'

SET VAR vGLCode INTEGER

LABEL LoopEnter

--Indent

  SET VAR vGLSegment = (.vGLSegmentBody + (CTXT(.vGLSegmentLevel)))

  SET VAR &vGLSegment INTEGER = (RNDDOWN(.vGLCode,.vRoundingLevel))

  IF &vGLSegment = .vGLCode THEN

    WRITE .vGLSegment

    GOTO LoopExit

  ELSE

    WRITE .vGLSegment

    SET VAR vGLSegmentLevel = (.vGLSegmentLevel + 1)

    SET VAR vRoundingLevel = (.vRoundingLevel + 1)

    GOTO LoopEnter

  ENDIF

--Outdent

LABEL LoopExit

LABEL Exit

--CLEAR VAR v%

RETURN

 

Reply via email to