Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 08 MAR 2005 02:12:41PM David Nicol wrote:

I am trying to get "Reduce" to work correctly and cannot figure out what is going askew. If I use RUN RLIST "LIST CONDOUNIT WITH PROPERYT EQ 16 BY PROPERTY BY UNIT", it works OK. But the program code in the report I trying to get working I the value of Key is '740*V11' and that is not a valid key.

Subroutine DP_OwnerBal (Dummy)

*

Declare Function DirectStart, DirectStop, DirectPrint, DirectPage

Declare Function Set_FSError

Declare Subroutine Reduce, Msg

$Insert Logical

Equ New_Exist$ To 0

Equ Next_Cur$ To 1

Equ Add_Exist$ To 2

HP_BOLD=Char(27) : "(s3B"

HP_NORM=Char(27) : "(s-5B"

retval=DirectStart("", "Owner Balance")

If retval 1 Then

Call Msg("","DirectStart Error: " : retval)

End

retval=DirectPrint("Test Print Line")

file_name=CONDOUNIT"

flag="

done=False$

Cursorvar="

For I=1 to 8

 ClearSelect I

Next I

SORT_LIST= "UNIT"

Reduce_Script=With {PROPERTY} EQ '16'"

mode=Next_Cur$

Reduce (Reduce_Script, SORT_LIST, Mode, file_name, Cursorvar, Flag)

If Flag Else

 status=Set_FSError()
 Return

End

*

SELECT file_name BY SORT_LIST Using Cursorvar ELSE

	status=Set_FSError()
      Return

End

*

O 0

*

* OPEN DICT AND DATA FILES

*

OPEN "DICT","CONDOUNIT" TO @DICT ELSE Return

OPEN "","CONDOUNIT" TO FILE.IN ELSE Return

OPEN "","CURRENT_MONTH" TO FILE.MONTH ELSE Return

READV S.CURRENT_MONTH FROM FILE.MONTH, 1, 1 ELSE Return

*

READRECORD:

!

*

*

* ZERO BREAK FLAGS TO FALSE

*

PROPERTY.BREAK=0

UNIT.BREAK=0

*

*

READNEXT Key USING Cursorvar by AT ELSE

LAST.RECORD=1

PROPERTY.BREAK=1

PROPERTY=PREV.PROPERTY

UNIT.BREAK=1

UNIT=PREV.UNIT

END

*

S.ATID=@ID

*

IF FIRST.PASS AND LAST.RECORD THEN

PRINT "ZERO Records Listed"

Call Msg("","Dave's 1ST Error: ":Key)

Return


At 08 MAR 2005 02:33PM [email protected] wrote:

Is it a truncation of a valid key and is the field indexed?

[email protected]

The Sprezzatura Group Web Site

World Leaders in all things RevSoft


At 08 MAR 2005 05:05PM David Nicol wrote:

Both fields involved with Reduce and Select by are btreive indexed and no the resulting key is not part of a valid key. Key to the file is 2 parts {PROPERTY}*{UNIT}

Both are defined as Integers. The property numbers range from 1 to 9999 and the units typically from 1 to 999

The resulting key shows the letter V after the *


At 09 MAR 2005 04:51AM [email protected] wrote:

When you say invalid, is that because you don't have keys in that format, or because you checked and the record does not exist.

[email protected]

The Sprezzatura Group Web Site

World Leaders in all things RevSoft


At 09 MAR 2005 01:32PM David Nicol wrote:

The results are invalid for two reasons. First, a record with that key does not exist and second the "V" in the second portion is not an integer. I don't know where that value is comming from and it is the only value that shows up for Key and the correct results should have 57 keys for that cursorvar (=1)

Dave


At 11 MAR 2005 05:53AM [email protected] wrote:

What happens if you change the reduce to a perform select call?

Do you see the same results?

[email protected]

The Sprezzatura Group Web Site

World Leaders in all things RevSoft


At 11 MAR 2005 06:26PM David Nicol wrote:

When looking through other queries about "reduce", I saw where someone suggested using RList instead of Reduce. I tried that method and it was successful. However, I still would like to find out how to use Reduce properly for future use.

I'm not quite sure how to do the select you suggested.


At 12 MAR 2005 10:09AM Warren Auyong wrote:

I just noticed that the Reduce_List contains mixed case in the script (e.g. With). I doubt if this makes a difference but it may. The RLIST subroutine (in 7.01 at least) wants all the RLIST keywords in caps. I always used caps for reduces in AREV. I don't recall if this was required or just my own preferences.


At 13 MAR 2005 01:28PM [email protected] wrote:

I must have had AREV on my mind. I mean making the select call inside of RLIST, which you've done. So something like

RLIST( 'SELECT CONODUNIT WITH PROPERTY=16 BY UNIT', 5 )

since this resovles down to a reduce.

If this select works, and your reduce call does not, then there is a syntax error in your program we are all overlooking. Warren might be on to something with the case.

[email protected]

The Sprezzatura Group Web Site

World Leaders in all things RevSoft


At 16 MAR 2005 02:35PM David Nicol wrote:

RList is working OK so I may just stick with it.

Thanks for the help

Dave


At 15 MAY 2006 10:14AM Christopher B Crous wrote:

I had the same problem and i fixed it by changing everything to uppercase. Even the WITH command.

Thanks Warren for the hint.

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/420816be1bb86d8e85256fbe00698809.txt
  • Last modified: 2023/12/28 07:40
  • by 127.0.0.1