Unique Key in Image detail set - QTP

Maloney, Charlie Charlie.Maloney@Cognos.com
Mon, 12 Mar 2001 16:42:20 -0500


Just thinking casually, but here are a few possibilities.
Pseudocode only.


1:  Easiest.
Use the EDIT as Bob Deskin suggested.  Try the retrieval
with a DEFINE instead of a TEMP, as most TEMPS aren't normally
processed until the OUTPUT PHASE.  This won't work if the same
request can both create the original detail record and write
the duplicate...


2:  Also easy.

Do an OUTPUT <file> ADD UPDATE, and make EVERY item statement
conditional so that record status is NOT changed if a record
is retrieved, as in

OUTPUT <file> ADD UPDATE VIA <your key> USING <your temporary>
ITEM <item> FINAL <expression/item/temporary> IF newrecord of <file>
ITEM <another item> FINAL <expression/item/temporary> IF newrecord of <file>
ITEM <yet another item> FINAL etc.

As you know, initialization is skipped for old records, so you
can leave your automatic and manual initializations alone.  Yes,
depending on the number of "IF" tests, your mileage may very...



3:  Also easy.  

Divide the ADD UPDATE into two QTP OUTPUT statements.
Use ALIAS as appropriate...

first one:

Do an OUTPUT <file> UPDATE with NO item statements...NONE.
This is a GET.  Set the ERROR clause correctly.
Without ITEM statements record status can't change, and
no PUT will occur.

second one:

Do a conditional OUTPUT <file> ADD, testing whether the
previous OUTPUT got a record.

OUTPUT <file> UPDATE IF newrecord of <previous OUTPUT file>
You can also try "IF ACCESSOK".  They should both work.
Note that there's only one "IF" test in this example.

There are other ways as well, such as 

o  Write a subfile

o  Link to your file in the ACCESS statement with an expression.
   Do a SELECT IF NOT <file> exists.  (Again, this won't work if the 
   same request can create the original records and write the 
   duplicates...)

o  Etc.




-----Original Message-----
From: Jim Nicoll [mailto:jnicoll@portofhalifax.ca]
Sent: Monday, March 12, 2001 3:10 PM
To: Deskin, Bob; powerh-l@sphere.swau.edu
Subject: Re: Unique Key in Image detail set - QTP


Hi Bob:

Thanks for your reply.

I had tried using an EDIT statement, but it seems that EDIT only works on
record items from input files or entries made in response to a PARM prompt.
In my case, the key item exists only in the output file (not in the input
file), and its value is set to a calculated value stored in a temporary item
(not in response to a PARM option). The EDIT statement does not want to
work.

Jim Nicoll
Halifax Port Authority
----- Original Message -----
From: "Deskin, Bob" <Bob.Deskin@Cognos.COM>
To: <powerh-l@sphere.swau.edu>
Sent: Monday, March 12, 2001 3:16 PM
Subject: RE: Unique Key in Image detail set - QTP


> Use an EDIT item LOOKUP NOTON. With the appropriate settings, you can
either
> have QTP fail or skip to the next transaction and simply report the error.
>
> Bob Deskin
> PowerHouse Web Product Manager and Senior Product Advisor
> Application Development Tools, Cognos Inc.
> bob.deskin@cognos.com (613) 738-1338 ext 7268 FAX: (613) 727-1178
> 3755 Riverside Drive P.O. Box 9707 Stn. T, Ottawa ON K1G 4K9 CANADA
>
> -----Original Message-----
> From: Jim Nicoll [mailto:jnicoll@portofhalifax.ca]
> Sent: March 12, 2001 11:50 AM
> To: powerh-l@sphere.swau.edu
> Subject: Unique Key in Image detail set - QTP
>
>
> Does anyone know of a *simple* , *efficient*, technique for enforcing a
> unique key in an Image detail set using QTP (ie. without modifying an
> existing data base structure or using multiple requests)?
>
> I believe that while you can specify a key as unique withing an Image
detail
> set in PDL, Image does not actually support this feature, and therefore
QTP
> will add second and subsequent records to a detail set with the same key.
>
> I have a QTP run where the key item value of the Output file is calculated
> in a temporary item based on values in the input files. I would like QTP
to
> fail if it attempts to add a record to an Image detail set using a
> non-unique key.
>
> Thanks in advance for any suggestions.
>
> Jim Nicoll
> Halifax Port Authority
>
>
> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
=
> Subscribe: "subscribe powerh-l" in message body to
majordomo@lists.swau.edu
> Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
> This list is closed, thus to post to the list, you must be a subscriber.
> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
=
> Subscribe: "subscribe powerh-l" in message body to
majordomo@lists.swau.edu
> Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
> This list is closed, thus to post to the list, you must be a subscriber.
>

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.