Removing Spaces

Deskin, Bob Bob.Deskin@Cognos.COM
Fri, 18 Mar 2005 06:05:16 -0500


In QUIZ, DEFINEs are evaluated as soon as the data required in the DEFINE is retrieved. They are not evaluated when referenced because they should not have changed. This provides a way to force the evaluation of a DEFINE by adding a reference to a particular file in the ACCESS list, such as IF RECORD <file> EXISTS.

IN QTP and QUICK, DEFINEs are evaluated when referenced because it would be very easy to have things change. Especially when you can have a DEFINE that references a REFERENCE file and that reference causes the REFERENCE file to be re-retrieved.

Bob

-----Original Message-----
From: powerh-l-admin@lists.sowder.com
[mailto:powerh-l-admin@lists.sowder.com]On Behalf Of brian_matthewsbrian
matthews
Sent: March 17, 2005 4:46 PM
To: powerh-l@lists.sowder.com
Subject: RE: Removing Spaces


after off list conversations, I now suspect that my remark 'defines are 
evaluated only when referenced' may be a fusion of related half-truths and 
not strictly accurate in this case.

Having said that, the part about adding syntax ' if record ... exists' is 
true, and WILL solve the problem.

I looked into this further and found that only the defines which do not 
reference a record item need this syntax to be added i.e. in this case, one 
of the setsytemval defines and the getsystemval; I believe this is because 
PH assumes that they are constants and need not be evaluated again. Once the 
defines are tied to a record item quiz will reavaluate for each record.

One other thing, I also believe that defines which are thought to be 
constants, are evaluated before any retrieval takes place - when they do not 
reference a record item.


regards Bri,


>From: "brian_matthewsbrian matthews" <brian_matthews_bmw@hotmail.com>
>To: johnsont@wfu.edu, powerh-l@lists.sowder.com
>Subject: RE: Removing Spaces
>Date: Thu, 17 Mar 2005 00:01:28 +0000
>
>a slight error in the earlier offering, the two setsystemval items should 
>have been coded as follows,
>
>DEFINE T-CC CHAR*6  = "Y" IF SETSYSTEMVAL("VAR_AA",(T-AA)) &
>             and  record PRIMARY-MST exists
>
>DEFINE T-DD CHAR*6  = "Y" IF SETSYSTEMVAL("VAR_BB","![REPL(VAR_AA,' 
>','')]")  &
>              and record PRIMARY-MST exists
>
>regards Bri,
>
>
>>From: "brian_matthewsbrian matthews" <brian_matthews_bmw@hotmail.com>
>>To: johnsont@wfu.edu, powerh-l@lists.sowder.com
>>Subject: RE: Removing Spaces
>>Date: Wed, 16 Mar 2005 22:34:35 +0000
>>
>>defines are evaluated only when referenced, try ' report T-AA T-CC T-DD 
>>T-BB '.
>>
>>If you want this to execute for many records in the file PRIMARY-MST you 
>>will probably have to modiffy three of the lines as below,
>>
>>>DEFINE T-CC CHAR*6  = "Y" IF SETSYSTEMVAL("VAR_AA",(T-AA)) &
>>if record PRIMARY-MST exists
>>
>>>DEFINE T-DD CHAR*6  = "Y" IF SETSYSTEMVAL("VAR_BB","![REPL(VAR_AA,' 
>>>','')]")  &
>>if record PRIMARY-MST exists
>>
>>>DEFINE T-BB CHAR*30 = GETSYSTEMVAL("VAR_BB")  &
>>if record PRIMARY-MST exists
>>
>>this is because items which do not reference record items are evaluated 
>>only once ( I think ), the code above ties the define processing to the 
>>primary file.
>>
>>
>>regards Bri,
>>
>>
>>>From: Ted Johnson <johnsont@wfu.edu>
>>>To: powerh-l@lists.sowder.com
>>>Subject: Removing Spaces
>>>Date: Wed, 16 Mar 2005 16:42:52 -0500
>>>
>>>I am trying to remove all the spaces from a field.  I found the following 
>>>code from some previous postings.
>>>
>>>DEFINE T-AA CHAR*20 = "12 456  789  A  B C"
>>>DEFINE T-CC CHAR*6 = "Y"  IF SETSYSTEMVAL("VAR_AA",(T-AA))
>>>DEFINE T-DD CHAR*6 = "Y" IF SETSYSTEMVAL("VAR_BB","![REPL(VAR_AA,' 
>>>','')]")
>>>DEFINE T-BB CHAR*20 = GETSYSTEMVAL("VAR_BB")
>>>REPORT T-AA T-BB
>>>go
>>>
>>>Which I changed to:
>>>
>>>ACCESS PRIMARY-MST
>>>
>>>SELECT IF BOX-CREATE-WHO = 'SCTSYNCH'
>>>
>>>DEFINE T-AA CHAR*30 = BOX-SORT-NAME
>>>DEFINE T-CC CHAR*6  = "Y" IF SETSYSTEMVAL("VAR_AA",(T-AA))
>>>DEFINE T-DD CHAR*6  = "Y" IF SETSYSTEMVAL("VAR_BB","![REPL(VAR_AA,' 
>>>','')]")
>>>DEFINE T-BB CHAR*30 = GETSYSTEMVAL("VAR_BB")
>>>REPORT T-AA T-BB
>>>GO
>>>EXIT
>>>
>>>However the output field T-BB is always blank.
>>>
>>>When I do
>>>
>>>ACCESS PRIMARY-MST
>>>
>>>DEFINE T-AA CHAR*30 = "Johnson, Theodore H."
>>>DEFINE T-CC CHAR*6  = "Y" IF SETSYSTEMVAL("VAR_AA",(T-AA))
>>>DEFINE T-DD CHAR*6  = "Y" IF SETSYSTEMVAL("VAR_BB","![REPL(VAR_AA,' 
>>>','')]")
>>>DEFINE T-BB CHAR*30 = GETSYSTEMVAL("VAR_BB")
>>>REPORT T-AA T-BB
>>>GO
>>>EXIT
>>>
>>>I get the following output
>>>
>>>T-AA                            T-BB
>>>
>>>Johnson, Theodore Harold        Johnson,TheodoreHarold
>>>
>>>Why can't I get the output to work correctly when reading from a field?
>>>
>>>Thanks,
>>>
>>>Ted Johnson
>>>
>>>
>>>
>>>--
>>>****************************************************
>>>Ted Johnson			johnsont@wfu.edu
>>>Information Systems
>>>Wake Forest University		336-758-4374
>>>Winston-Salem, NC 27109		336-758-7127 FAX
>>>
>>>"Good judgment comes from experience and a lot of
>>>that comes from bad judgment".
>>>			 -- Richard Karn
>>>
>>>
>>>
>>>= = = = = = = = = = = = = = = = = = = = = = = = = = = =
>>>Mailing list: powerh-l@lists.sowder.com
>>>Subscribe: "subscribe" in message body to 
>>>powerh-l-request@lists.sowder.com
>>>Unsubscribe: "unsubscribe <password>" in message body to 
>>>powerh-l-request@lists.sowder.com
>>>http://lists.sowder.com/mailman/listinfo/powerh-l
>>>This list is closed, thus to post to the list you must be a subscriber.
>>
>>_________________________________________________________________
>>Want to block unwanted pop-ups? Download the free MSN Toolbar now!  
>>http://toolbar.msn.co.uk/
>>
>>= = = = = = = = = = = = = = = = = = = = = = = = = = = =
>>Mailing list: powerh-l@lists.sowder.com
>>Subscribe: "subscribe" in message body to 
>>powerh-l-request@lists.sowder.com
>>Unsubscribe: "unsubscribe <password>" in message body to 
>>powerh-l-request@lists.sowder.com
>>http://lists.sowder.com/mailman/listinfo/powerh-l
>>This list is closed, thus to post to the list you must be a subscriber.
>
>_________________________________________________________________
>It's fast, it's easy and it's free. Get MSN Messenger today! 
>http://www.msn.co.uk/messenger
>
>= = = = = = = = = = = = = = = = = = = = = = = = = = = =
>Mailing list: powerh-l@lists.sowder.com
>Subscribe: "subscribe" in message body to powerh-l-request@lists.sowder.com
>Unsubscribe: "unsubscribe <password>" in message body to 
>powerh-l-request@lists.sowder.com
>http://lists.sowder.com/mailman/listinfo/powerh-l
>This list is closed, thus to post to the list you must be a subscriber.

_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo

= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l@lists.sowder.com
Subscribe: "subscribe" in message body to powerh-l-request@lists.sowder.com
Unsubscribe: "unsubscribe <password>" in message body to powerh-l-request@lists.sowder.com
http://lists.sowder.com/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber. 
  
       This message may contain privileged and/or confidential information.  If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so.  Thank you.