<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16608" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=810102219-05032008><FONT face=Arial 
color=#0000ff size=2>That helped Bob, thanks.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=810102219-05032008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=810102219-05032008><FONT face=Arial 
color=#0000ff size=2>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.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=810102219-05032008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=810102219-05032008><FONT face=Arial 
color=#0000ff size=2>Ken</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> 
powerh-l-bounces+ken.langendock=rogers.com@lists.sowder.com 
[mailto:powerh-l-bounces+ken.langendock=rogers.com@lists.sowder.com] <B>On 
Behalf Of </B>Deskin, Bob<BR><B>Sent:</B> March 5, 2008 1:25 PM<BR><B>To:</B> 
Ken Langendock; powerh-l@lists.sowder.com<BR><B>Subject:</B> RE: Help with 
Cursor in QDESIGN<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>
<DIV dir=ltr align=left><SPAN class=515471518-05032008><FONT face=Arial 
color=#0000ff size=2>Here's something I got to work:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=515471518-05032008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=515471518-05032008><FONT face=Arial 
color=#0000ff size=2>screen t<BR>temp sk_flag char*1<BR>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')<BR>cursor x 
occurs 10<BR>access request sk_flag orderby sk<BR>field sk_flag<BR>align (,,1) 
(,,25) (,,50)<BR>cluster occurs with x<BR>field sk size 20<BR>field branch size 
20<BR>field city size 20</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=515471518-05032008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=515471518-05032008><FONT face=Arial 
color=#0000ff size=2>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.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=515471518-05032008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=515471518-05032008><FONT face=Arial 
color=#0000ff size=2>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.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=515471518-05032008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=515471518-05032008><FONT face=Arial 
color=#0000ff size=2>Bob</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> 
  powerh-l-bounces+bob.deskin=cognos.com@lists.sowder.com 
  [mailto:powerh-l-bounces+bob.deskin=cognos.com@lists.sowder.com] <B>On Behalf 
  Of </B>Ken Langendock<BR><B>Sent:</B> March 5, 2008 11:17 am<BR><B>To:</B> 
  powerh-l@lists.sowder.com<BR><B>Subject:</B> Help with Cursor in 
  QDESIGN<BR></FONT><BR></DIV>
  <DIV></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Arial size=2>Hello all, I need 
  some help with making my screen work the way I want it 
too.</FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Arial 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Arial size=2>I have a table 
  (simplified version):</FONT></SPAN><SPAN class=247380616-05032008><FONT 
  face=Arial size=2></FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Courier size=2>RECORD 
  Users</FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Courier size=2>&nbsp; UserId 
  CHARACTER * 8, &amp;</FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Courier size=2>&nbsp; UserName 
  CHARACTER * 40</FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Arial 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Arial size=2>On a screen the 
  User can select to view the data in&nbsp;UserId&nbsp;or UserName order by 
  means of a function key (toggle switch).</FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Arial size=2>I use a variable 
  (not actual syntax)</FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Arial 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Courier size=2>Element T-Option 
  CHARACTER * 1 </FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Courier size=2>&nbsp; Values 
  "C" CAPTION "Code" </FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Courier 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "D" CAPTION 
  "Description"</FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Arial 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Arial size=2>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.</FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Arial size=2>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.</FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Arial size=2>Maybe this needs a 
  declare clause embedded...not sure</FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Arial 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Courier size=2>@if 
  ORACLE<BR>SQL IN MYDB &amp;<BR>&nbsp;&nbsp; DECLARE UsersCursor CURSOR FOR 
  &amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp; SELECT Users.UserId, 
  &amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  Users.UserName, 
  &amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  <FONT color=#ff0000>Users.UserName AS SortField&nbsp; 
  &amp;<BR></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM Users 
  &amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE 'D' = :T-Option 
  &amp;<BR>&nbsp;&nbsp;&nbsp; UNION ALL &amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp; SELECT 
  Users.UserId, 
  &amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  Users.UserName, 
  &amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  <FONT color=#ff0000>Users.UserId AS SortField&nbsp; 
  &amp;<BR></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM Users 
  &amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE 'C' = :T-Option 
  &amp;<BR>&nbsp;&nbsp; ORDER BY SortField</FONT></SPAN></DIV>
  <DIV><FONT face=Courier size=2></FONT>&nbsp;</DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Courier size=2>CURSOR 
  UsersCursor PRIMARY &amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ALIAS Users 
  &amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OCCURS 17<BR>@else<BR>FILE Users 
  PRIMARY &amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp; OCCURS 17<BR>&nbsp; ACCESS VIA 
  UserId &amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  SEQUENTIAL<BR>@endif<BR></FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Courier size=2>Any help would 
  be appreciated.</FONT></SPAN></DIV>
  <DIV><SPAN class=247380616-05032008><FONT face=Courier 
  size=2>Ken</DIV></FONT></SPAN>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV>&nbsp;</DIV></BLOCKQUOTE></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp; This message may contain privileged and/or 
confidential information.&nbsp; 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.&nbsp; Thank you. 
</DIV></BODY></HTML>