Re: QBE question
Posted in 1993
In article <1l6chjINNkrg@emory.mathcs.emory.edu> dave.snyder@snide.com (Dave Snyder) writes: >Quoting Mark S. Winsor... >} >} Given a table with 2 columns, col1 & col2, is it possible to reference a >} column name from within the input field. Example: Give me all records >} where col2 = (col1 / 2). >} >} col1 [ ] >} col2 [(col1 / 2) = col2] <- I'd like to be able to enter this in an >} input field of a query by example. >} >Nope, CONSTRUCT will choke on the non-numeric characters. You'll get a >message similar to "Error in field". > >DAS >-- >David Snyder @ Snide Computer Services - Folcroft, PA Current Release > is db4glgen-3.9 >UUCP: ..!uunet!das13!dave INTERNET: dave.snyder@snide.com Actually, there is a way to do this but it doesn't involve CONSTRUCT. I got tired of using CONSTRUCT back in the 4.0 version, which didn't let you use ON KEY. At that time I wrote my own construct-type function in 4gl. It's kind of a pain to use since you have to pass it the name of each field separately along with what the user typed into that field. It parses what the user typed in and creates WHERE statements that allow for >,<, MATCHES, OR's, etc. It could probably be modified to handle this kind of search. I can mail it if you want, but I warn you it's probably badly programmed and commented. P.S. Another reason I wrote this function was CONSTRUCT's IMHO poor parsing ability for user input that includes *'s. If a user types in A*|B then I think CONSTRUCT should turn this into (field MATCHES "A*" or field = "B") but in fact CONSTRUCT does field in ("A*","B") Other people out there might want to watch out for this.