Help with Cursor in QDESIGN

Ken Langendock Ken at Langendock.com
Wed Mar 5 13:23:29 CST 2008


That helped Bob, thanks.
 
I was under the assumption that the UNION required all columns to be the
same size, turns out all it wants is the same number of columns.
 
Ken

  _____  

From: powerh-l-bounces+ken.langendock=rogers.com at lists.sowder.com
[mailto:powerh-l-bounces+ken.langendock=rogers.com at lists.sowder.com] On
Behalf Of Deskin, Bob
Sent: March 5, 2008 1:25 PM
To: Ken Langendock; powerh-l at lists.sowder.com
Subject: RE: Help with Cursor in QDESIGN


Here's something I got to work:
 
screen t
temp sk_flag char*1
declare x cursor for select branch, city, branch as sk from branches where
(:sk_flag = 'B') union all select branch, city, city as sk from branches
where (:sk_flag = 'C')
cursor x occurs 10
access request sk_flag orderby sk
field sk_flag
align (,,1) (,,25) (,,50)
cluster occurs with x
field sk size 20
field branch size 20
field city size 20
 
When you do a find on this screen, you're prompted for sk_flag. Entering a B
results in a sequence by Branch and entering C results in a sequence by
City. Note that the temp sk_flag must be declared before the cursor. It's
the cursor statement where the SQL is parsed. For some reason I had to put
the orderby on the access statement. I kept getting syntax errors when I put
it on the declare cursor.
 
I'm sure you could run a DESIGNER procedure from your function keys that set
sk_flag and did a PUSH FIND or something similar.
 
Bob


  _____  

From: powerh-l-bounces+bob.deskin=cognos.com at lists.sowder.com
[mailto:powerh-l-bounces+bob.deskin=cognos.com at lists.sowder.com] On Behalf
Of Ken Langendock
Sent: March 5, 2008 11:17 am
To: powerh-l at lists.sowder.com
Subject: Help with Cursor in QDESIGN


Hello all, I need some help with making my screen work the way I want it
too.
 
I have a table (simplified version):
RECORD Users
  UserId CHARACTER * 8, &
  UserName CHARACTER * 40
 
On a screen the User can select to view the data in UserId or UserName order
by means of a function key (toggle switch).
I use a variable (not actual syntax)
 
Element T-Option CHARACTER * 1 
  Values "C" CAPTION "Code" 
         "D" CAPTION "Description"
 
In my screen I created a cursor to handle the orderby but I have no idea if
I can "override" a field size in the statement.
See below, SortField needs to be the same size (character * 40) for the
Cursor to work but I can't get the syntax to work.
Maybe this needs a declare clause embedded...not sure
 
@if ORACLE
SQL IN MYDB &
   DECLARE UsersCursor CURSOR FOR &
     SELECT Users.UserId, &
            Users.UserName, &
            Users.UserName AS SortField  &
       FROM Users &
      WHERE 'D' = :T-Option &
    UNION ALL &
     SELECT Users.UserId, &
            Users.UserName, &
            Users.UserId AS SortField  &
       FROM Users &
      WHERE 'C' = :T-Option &
   ORDER BY SortField
 
CURSOR UsersCursor PRIMARY &
       ALIAS Users &
       OCCURS 17
@else
FILE Users PRIMARY &
     OCCURS 17
  ACCESS VIA UserId &
         SEQUENTIAL
@endif

Any help would be appreciated.
Ken
 
 

 
     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. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sowder.com/pipermail/powerh-l/attachments/20080305/759dd83e/attachment.html


More information about the powerh-l mailing list