Focal Point
[SOLVED] Maintain Copy with Where

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2521089092

July 09, 2008, 10:57 AM
brjohnson
[SOLVED] Maintain Copy with Where
Hello,

The function below is supposed to only copy records into the GetClientsStack WHERE SBH EQ searchHank. It seems that the WHERE clause is being ignored, because all records are being copied. I've tried with STACK COPY and FOR ALL COPY. When I tried to use just COPY I got an error saying a COPY with a WHERE requires a FOR. I'm really stumped...hopefully someone will be able to enlighten me on what I'm doing wrong.
 CASE SearchClientsByHank
REPOSITION fow_clients.FOW_CLIENTS.HFCCID ;
STACK CLEAR GetClientsStack ;
STACK CLEAR SearchClientsStack;
FOR ALL NEXT fow_clients.FOW_CLIENTS.HFCCID INTO SearchClientsStack;
REPEAT SearchClientsStack.FOCCOUNT; i = 1;
	COMPUTE SearchClientsStack(i).SBH/D7L = ATODBL(SearchClientsStack(i).HFCCID, '07', SearchClientsStack(i).SBH);
	COMPUTE i = i + 1;
ENDREPEAT
STACK COPY FROM SearchClientsStack INTO GetClientsStack WHERE (SearchClientsStack.SBH EQ searchHank);
COMPUTE searchHank="";
ENDCASE 

This message has been edited. Last edited by: brjohnson,


Bryan Johnson
WebFOCUS 7.7.03
Maintain
Win 7
Excel, PDF, HTML
July 09, 2008, 12:11 PM
j.gross
quote:
STACK COPY FROM SearchClientsStack INTO GetClientsStack WHERE (SearchClientsStack.SBH EQ searchHank);


In the WHERE clause, remove the stack-name qualification and the parentheses.
-- Documentation specifies the first operand is an unqualified 'field', which is implicity qualified by the origin stack-name.
-- The syntax does not allow for surrounding parentheses (although they may occur within the 'expression' for the second operand).

Also, verify the values that ATODBL is producing. If not as expected, it may help to use scalars as the operands.


- Jack Gross
WF through 8.1.05
July 09, 2008, 12:30 PM
brjohnson
Thanks Jack!!!!!

That worked perfectly. Did you find these rules in the standard help files, or did you find them somewhere else? I didn't see anything like what you recommended in the help files.


Bryan Johnson
WebFOCUS 7.7.03
Maintain
Win 7
Excel, PDF, HTML
July 09, 2008, 01:18 PM
j.gross
I had my suspicions. Searching techsupport for "STACK COPY" and "WHERE", I found these:

1. This document gives syntax, with examples that make clear that stack-name qualification is not required. (Since the syntax of "WHERE ..." is restrictive -- the left operand must name an element of the source stack -- and does not indicate that the condition may be parenthesized, it is prudent to suppress the impulse to parenthesize.

2. This article explains what can go wrong when you include qualification.


- Jack Gross
WF through 8.1.05