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 28 APR 2000 07:12:22PM Bruce wrote:

Hello,

Is the reduce statement capable of filtering-out multi-value lines based on the criteria I specify. If not, is there another method of doing this. Basically, I have to create a report that sorts the report by product-type (Each multi-value line on the invoice contains a product, and each product has a product type). I need to sort by the product type. Otherwise, I will just have to code it.

Thanks Bruce.


At 29 APR 2000 12:07AM Don Bakke wrote:

Bruce,

Reduce is a specifically for row/record filtering, not values within a multi-value field. The closest you can get to this is to use the LIMIT statement within the R/List statement. Note, this will not eliminate rows/records from your selection but it will suppress the display within exploded reports based on the criteria you specify.

[email protected]

SRP Computer Solutions


At 29 APR 2000 03:28AM Richard Hunt wrote:

I do not know of any way to use the "REDUCE" statement to "LIMIT" multivalued fields.

I do know how to do it using the TCL SELECT statement within a BASIC program. Because of this limitation that "REDUCE" has, I always use the TCL SELECT statement. Here is an example on how I do it…

The file name is "CITY".

The multivalued field name is "ZIP".

Look very carefully at the "READNEXT" statement. It has a variable "ID" (record key) and a variable "VALUE" (value position in the multivalued field).

* Define variables.

FALSE=0

TRUE=1

FM=@FM

*

* First select to explode the multivalues. SENTENCE=SELECT CITY WITH ZIP "5" BY-EXP ZIP' PERFORM SENTENCE IF @RECCOUNT ELSE STOP END *

* Second select to limit the multivalue selection.

SENTENCE=SELECT CITY WITH ZIP "5"'

PERFORM SENTENCE

IF @RECCOUNT ELSE

STOP

END

*

PERFORM SENTENCE

IF @RECCOUNT ELSE

STOP

END

*

* Get the next record id and multivalue from the select list. DONE=FALSE LOOP READNEXT ID,VALUE ELSE DONE=TRUE END UNTIL DONE DO *

* Get record from the file.

ZIPS=XLATE('CITY',ID,'ZIP','X')

ZIP=ZIPS

REPEAT

STOP

END

View this thread on the forum...

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