Reduce puzzle (OpenInsight 32-bit Specific)
At 13 MAR 2003 12:23:50PM Kauko Laurinolli wrote:
* I have tried to make this code with Reduce to work w/o success
Table=CLIENTS'
Open Table TO FILE_IN Then
OPEN 'DICT', Table to @DICT ELSE NullEnd Else
Msg("Can't open"); ReturnEnd
Flag='; Done=False$; CursorVar='; Mode=NEXT_CUR$
Sort_List=COMPANY' :@FM: 'LOCATION' :@FM: 'TY'
*Reduce_Script=with {CITY} EQ "SAO PAULO"' ;this won't even run, Zero records
*Reduce_Script=with {CITY} EQ SAO PAULO' ;this runs but results are wrong (city not selected
Reduce_Script=with {CU_NO} LT "9900"' ;only this one works
Reduce(Reduce_Script, Sort_List, Mode, Table, CursorVar, Flag)
/* CU_NO is the key, CITY etc are not symbolic
Why the reduce will not work properly?
*/
At 13 MAR 2003 01:07PM Richard Hunt wrote:
Kauka,
I tested similar logic and it worked for me. This is the code I used for the test. Note that I used my file called PRCM.
DECLARE SUBROUTINE REDUCE
REDUCE_SENTENCE=WITH {NAME} EQ "LAST, FIRST"'
SORT_SENTENCE=NAME'
REDUCE(REDUCE_SENTENCE,SORT_SENTENCE,1,'PRCM',CURSOR,STATUS)
SELECT 'PRCM' BY SORT_SENTENCE USING CURSOR ELSE
END
DONE=0
LOOP
READNEXT ID USING CURSOR BY AT ELSE
DONE=1
END
UNTIL DONE DO
REPEAT
Be sure you are using the correct "SELECT BY" statement and the correct "READNEXT USING" statement.
At 13 MAR 2003 02:31PM Oystein Reigem wrote:
Kauko,
Reduce_Script=with {CITY} EQ "SAO PAULO"' ;this won't even run, Zero records
Doublecheck with a
RUN RLIST 'LIST CLIENTS WITH CITY=SAO PAULO"'
in System Editor's Exec line.
(Could the lowercase with be a problem??)
Is it important for you to use Reduce()? Some of us have had problems when using compound searches ('WITH {CITY} EQ "SAO PAULO" AND WITH {COMPANY} EQ "ELETROPAULO"'). I've switched to Rlist() myself.
- Oystein -
At 13 MAR 2003 03:05PM Kauko Laurinolli wrote:
RUN RLIST 'LIST CLIENTS WITH CITY=SAO PAULO"'
brings keys of those records on printer OK.
But Rlist('SELECT CLIENTS BY COMPANY BY LOCATION BY TY',TARGET_ACTIVELIST$,
,
,'')will not bing up a single record? I am lost with this too.
The purpose is after Rlist to:
READRECORD:
ReadNext @ID Using CursorVar Else
ReturnEND
IF FIRST_PASS AND LAST_RECORD THEN
Msg("ZERO Records Listed"); ReturnEND
Read @RECORD from FILE_IN,@ID ELSE
ReturnEnd
*Here I do my printing etc.
GOTO READRECORD
At 13 MAR 2003 03:37PM Richard Hunt wrote:
If you are going to use the "RLIST" statement, you must use the "READNEXT" statement as follows…
READNEXT @ID ELSE
DONE=1
END
You can not use the following readnext with rlist…
READNEXT @ID USING CURSOR ELSE
DONE=1
END
At 13 MAR 2003 04:01PM Kauko Laurinolli wrote:
Now I finally got the Rlist.
I don't see this in any of the docs but SELECT, BY ,WITH etc. has to be in CAPS before they work?
At 14 MAR 2003 04:48AM Oystein Reigem wrote:
Kauko,
I don't know if uppercase is necessary. I just always do it.
- Oystein -
At 14 MAR 2003 08:18AM Kauko Laurinolli wrote:
Thanks y'll. I finally figured Rlist out.
Why Reduce is obviously faulty and nobody hasn't fit it yet?
At 14 MAR 2003 09:33AM [url=http://www.sprezzatura.com" onMouseOver=window.status= Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
FWIW R/List USES Reduce so it must in some way be your use of it that is at fault, not Reduce itself.
World Leaders in all things RevSoft