[[https://www.revelation.com/|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]] ==== Reducing Multivalue lines using the Reduce Statement (OpenInsight Specific) ==== === At 28 APR 2000 07:12:22PM Bruce wrote: === {{tag>"OpenInsight Specific"}} 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. dbakke@srpcs.com [url=http://www.srpcs.com]SRP Computer Solutions[/url] [img]http://www.srpcs.com/srpicon1.gif[/img] ---- === 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 [[https://www.revelation.com/revweb/oecgi4p.php/O4W_HANDOFF?DESTN=O4W_RUN_FORM&INQID=NONWORKS_READ&SUMMARY=1&KEY=8664E8B35561D2CE852568CF007F79FB|View this thread on the forum...]]