Re: newby question
Connie Cocanougher <[email protected]> Wed, 09 Aug 2006 09:11:31 -0400
| Newsgroups | gmane.comp.lang.4gl.fourjs.user |
|---|---|
| Message-ID | <[email protected]> |
Yes, I'm attaching the entire function. When I comment out the two select statements that select max(dates), it compiles. >Hi Connie, > >Something in the code above this line does not appear to be correct, >start looking above this SQL statement, You do have a function named in >your 4GL code right? > >Eg. > >Function do_something() > define h_last_ship date, > p_accust record like accust.* > > select max(date_prepared) into h_last_ship > from sncordm > where custnum = p_accust.cust_code > > >End function > > > _____ > > >Richard Turner > >Software Developer > > > >Phone: (613) 226-5511 ext. 2142 Fax: (613) 226-3377 >Email: [email protected] >1 Antares Drive, Suite 400 >Ottawa, Ontario, Canada >K2E 8C4 > >This message is intended exclusively for the individual or entity to >which it is addressed. This communication may contain information that >is proprietary, privileged or confidential or otherwise legally exempt >from disclosure. If you are not the named addressee, you are not >authorized to read, print, retain, copy or disseminate this message or >any part of it. If you have received this message in error, please >notify the sender immediately by e-mail and delete all copies of the >message. > > > >-----Original Message----- >From: [email protected] [mailto:[email protected]] On >Behalf Of Connie Cocanougher >Sent: Monday, August 07, 2006 4:47 PM >To: [email protected] >Subject: [fourjs-users] newby question > > > >Any idea why I would get an error with this when trying to compile using >BDS? > > select max(date_prepared) into h_last_ship >| A grammatical error has been found at 'select' expecting: $ FUNCTION >REPORT. >| See error number -6609. > from sncordm > where custnum = p_accust.cust_code > > > >
my.function
(text/plain, 3.5 KB)
FUNCTION query_row()
let int_flag = 0
display
"QUERY : ESCAPE queries. "
at 1 ,1
construct by name query_1 on bus_name, cust_code, address1, address2,
city, state, zip, country, curr_code,
mainarea, mainphone, maincntry,
mfaxarea, mfaxnum, mfaxcntry,
apcontact, aparea, apphone, apcntry,
apfarea, apfax, apfcntry, acct_bal,
cust_type, industry, salesperson,
comm_code, oncontact, terms_code,
credit_limit, last_cred_check,
last_cred_change, tax_num, tax_expire_date,
sic_code, naics_code, fed_id, cust_since,
doing_bus_since, finance_ch, ins_limits
let sel_stmt = "select * from accust where ", query_1 clipped
prepare s1 from sel_stmt
let sel_stmt = "select count(*) from accust where ", query_1 clipped
prepare s2 from sel_stmt
declare count_curs cursor for s2
open count_curs
fetch count_curs into hold_count
declare get_curs scroll cursor with hold for s1
open get_curs
fetch first get_curs into p_accust.*
if status = notfound then
let chosen = false
message "NO ROWS FOUND."
close get_curs
return
end if
clear form
initialize checkperm to null
select credit into checkperm
from maillist
where login = hold_user
if checkperm = "Y" then
else
let p_accust.ins_limits = null
end if
select max(date_prepared) into h_last_ship
from sncordm
where custnum = p_accust.cust_code
select max(doe) into h_last_order
from ncordm
where custnum = p_accust.cust_code
if status = notfound then
select max(doe) into h_last_order
from sncordm
where custnum = p_accust.cust_code
end if
display by name p_accust.cust_code ,
p_accust.bus_name ,
p_accust.oncontact ,
p_accust.address1 ,
p_accust.address2,
p_accust.city ,
p_accust.state ,
p_accust.zip ,
p_accust.country ,
p_accust.mainarea ,
p_accust.mainphone ,
p_accust.maincntry,
p_accust.mfaxarea,
p_accust.mfaxnum,
p_accust.mfaxcntry,
p_accust.apcontact ,
p_accust.aparea ,
p_accust.apphone ,
p_accust.apcntry,
p_accust.apfarea,
p_accust.apfax ,
p_accust.apfcntry,
p_accust.cust_type ,
p_accust.salesperson ,
p_accust.comm_code ,
p_accust.industry ,
p_accust.sic_code,
p_accust.naics_code ,
p_accust.tax_num ,
p_accust.tax_expire_date,
p_accust.fed_id ,
p_accust.finance_ch ,
p_accust.terms_code,
p_accust.cust_since ,
p_accust.doing_bus_since ,
p_accust.credit_limit ,
p_accust.last_cred_check ,
p_accust.last_cred_change ,
p_accust.curr_code ,
p_accust.ins_limits ,
p_accust.acct_bal ,
p_accust.bal_as_of
display "1 of " , hold_count using "#####",
" row(s) found. " at 22,15
let counter = 1
let chosen = true
END FUNCTION