× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Don -

We do SQL in Net.Data in one of two ways:

Sometimes most of the SQL string is static and only a little has user input.
Here's a sample - the variable "stock" came from user input

%FUNCTION(DTW_SQL) Get_Last_Memo (IN stock, START_ROW_NUM,
OUT SQLtable) {
SELECT
*
FROM ohbfp/INF41 left join ohbfp/inf40 on MMMMNO = MDMMNO and MMMAN = MDMAN
where MDSTNO = '$(stock)' and MMSTAT <> 'V'
order by MMMMDT desc, MMMMNO desc
%message{
100: " " :continue
+default: " " : continue
-default: "Error - SQL return code $(RETURN_CODE) " :exit
%}
%}



Sometimes we build the whole SQL string using an RPG program, then pass the
entire SQL string to the SQL function. Here's an example where the input
selection screen has a lot of parms, and we use RPG to create the acutal SQL
string


@GetSearchString ($(ItemType),
$(ItemSubType),
$(Class),
$(Style),
$(Desc),
$(MinPrice),
$(MaxPrice),
$(ppMemo),
$(ppOHB),
$(ppSold),
$(ppSalesp),
$(ppUnReg),
$(Location),
$(EverBeen),
$(SupID),
$(Cert),
searchstring)
@Find_Item (searchstring)


%FUNCTION(DTW_directcall)
GetSearchString (in char(6) ppItemType,
char(6) ppItemSubType,
char(5) ppClass,
char(12) ppStyle,
char(30) ppDesc,
char(10) ppMinPrice,
char(10) ppMaxPrice,
char(1) ppMemo,
char(1) ppOHB,
char(1) ppSold,
char(1) ppSalesp,
char(1) ppUnReg,
char(6) ppLoc,
char(1) ppEverBeen,
char(6) ppSuID,
char(1) ppCert,
inout char(800) searchstring
) {
%exec { /QSYS.LIB/OHBPP.LIB/INR701.PGM %}
%}



%FUNCTION(DTW_SQL) Find_Item (IN searchstring ) {

$(searchstring)

%report{
put all your report info here


Hope this helps

Larry Kleinman
Kleinman Associates, Inc.
212-949-6469
203-255-4100



"Don Cavaiani"
<dcavaiani@amereq
uip.com> To
Sent by: <web400@xxxxxxxxxxxx>
web400-bounces@mi cc
drange.com
Subject
[WEB400] Net.data Macro/SQL
01/18/2008 03:27 SELECTIONS
PM


Please respond to
Web Enabling the
AS400 / iSeries
<web400@midrange.
com>







I currently have the following steps in the browser selection. Each step
executes it own SQL select/sort command, and essentially displays data in
the same output format.

Top of Form 1

PICK the number of the SEARCH method:
1=Gage_ID____
2=Type_______
3=Range______
4=Location____
5=Cert_Number
6=By_Cal.Date
(THEN click Submit)

How would I go about creating say only ONE sequel statement, then having the
operator choose their various sort fields, then fill the ONE SQL statement
accordingly. Basically - how to do simple substitutions into a SQL
statement in net.data.
Bottom of Form 1

Don F. Cavaiani
IT Manager
Amerequip Corp.
920-894-7063

"It's amazing what you can accomplish if you don't care who gets the
credit." Harry S. Truman



--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.