[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
[sqr-users] RE: INPUT Parms
Hi Mike,
You can do this by putting the INPUT in a loop and concatenating the values as
the user inputs them. Here is an example that also gives the user the option
of selecting all values (in which case there will not be a condition generated):
! opening quote
move '''' to $order_groups
while 1 = 1
input $order_group maxlen=6 'Enter Order Group or ''ALL'' or leave
blank to exit'
uppercase $order_group
! if user selects all order groups, there will be no condition
generated (see statement following loop)
if $order_group = 'ALL'
move $order_group to $order_groups
move '' to $select_order_groups
break
end-if
! final quote and break out of loop when user has not input a value
if rtrim($order_group, ' ') = ''
concat '''' with $order_groups
break
end-if
! concatenate comma if there is already an order group in the string
if $order_groups <> ''''
concat ''',''' with $order_groups
end-if
! concatenate order group value
concat $order_group with $order_groups
end-while
! set up condition to be used in WHERE clause (if not all order groups)
if $order_groups <> 'ALL'
let $select_order_groups = 'and h.order_grp in ('||$order_groups||')'
end-if
HTH,
Denise M. White
Sr. Software Engineer
Vicor
--__--__--
Message: 2
Date: Mon, 20 Oct 2003 08:50:44 -0500
From: "Hunsaker, Michael S" <mhunsake@indiana.edu>
To: <sqr-users@sqrug.org>
Subject: [sqr-users] INPUT Parms
Reply-To: sqr-users@sqrug.org
Hello -
I am trying to use an INPUT statement to grab one or more choices from
the user. For example, my input statement:
Input $campus 'Enter Campus Code: ' type=char
I am asking the user to enter the campus or campuses to view data for.
The main problem I am running into is building the dynamic where clause.
Since the user input will look something like the below line, I cannot
build the data into a where clause without the single quotes.
BL, IN, SB
Is there an easy way to pad each input with single quotes? I would like
the response to look like this in order to build the dynamic where
clause.
'BL','IN','SB'
Since I am new to SQR, I am probably overseeing a particular function
that would help me out. Normally there are "explode/implode" functions
to be used in cases like these.
Thanks.
Mike
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users