RE: help - input a search list from a form
Posted in 1996
Mickey,
use a char var instead, and prepare the statement. But then, any wrong input from your users will surely result in a sintax error, so why don't just use a CONSTRUCT?
you can even mix inputs and constucts, like the code below, if you want the user to put single values for everything except the project field:
define your_rec record
#
# define your record here
#
project_codes char(70)
end record,
prepare_str char(1000),
lk smallint
input by name your_rec.*
#
# your before after fields here
#
before field project
construct by name your_rec.project_codes on project_code
#
# your construct clauses here
#
end construct
let lk=fgl_lastkey()
case
when (lk=13) or (lk=fgl_keyval("down"))
next field next
when (lk=fgl_keyval("accept"))
exit input
otherwise
next field previous
end case
end input
let prepare_str="select * from <your_table> where",
<concatenate your field values here>,
"and ", your_rec.project_codes
Obviously in the screen record, the project_codes field will be an integer. Also note that in 4gl 4.11 and below, it is not allowed to nest inputs and/or constructs, so you will have to embend the costruct in a function and call that instead.
ciao,
marco.
____________________________________________________________________________
rem radioterapia, which I immeritately manage, seldom agrees with what I say
marco greco (Catania, Italy) Work:
marcog@ctonline.it rem radioterapia 39 95 447828 fax 446558
(was mar.greco@agora.stm.it) Achea 39 95 503117
--- On Thu, 13 Jun 1996 21:41:52 GMT Mickey Mestel <mickm@netcom.com> wrote:
hi all,
i have a 4gl program that obtains it's search criteria from a
compiled form. i need to modify this so that i can get a list for an
IN clause in my program. in coding terms, i'm adding the line to my
query
define g_project_codes char(100)
select ...
...
*and project_code in (g_project_codes) *
and ...
the column project_code is an integer. i tried to set up a
character field on my screen that looks like this:
Project Code [f003 ]
f003 = formonly.g_project_code type integer;
with the hopes of getting something like this from the user:
Project code [1015, 1085, 1033 ]
when i run the program, it bombs out with an error 407, which is
a communications error with the server: not all that useful.
i have the program working if i declare my screen field and
variable as integer, but then i can only run the report for one project
at a time. not what i want...
can anyone give me any hints as to how to do this? i'm running
version 4.12.UE3 of 4gl on sunos 4.1.4, and 7.13 of OnLine on solaris
2.4.
thanks in advance.
mickm
--
_____________________________________________________________________________
Mickey Mestel mickm@netcom.com
-on a beach in thailand to a beautiful, stoned, norwegian woman:
"..yeah, it's just another foreign country without ice."
-----------------------------------------------------------------------------
-----------------End of Original Message-----------------