That is pretty nifty. I'm not sure I'd want to use it generally because
of readability but for my data selection functions it might be just the
thing to associate the sql statements with the appropriate function!

Ric

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Miller, Raul D
Sent: Wednesday, 14 February 2007 15:22
To: Programming forum
Subject: RE: [Jprogramming] Possible to nest multiline noun
definitionwithinverb definition?

Ric Sherlock wrote:
> I'm sure I'm being dense but I can't work out how the code you sent
> would help me define a multiline noun that is _local_ to the verb in
> which it is defined.\
 
Since you're not using x in your verb, this should do it:
 
GetPrices=:(0 :0)&(4 :0)
 sqlcmd=. x
 NB. get last three columns of query
 profiles=. > _3 {."1 }. y query__db sqlcmd
 NB. assign each column to name
 'pp mfd prc'=: |: data
 NB. box profiles by client
 profiles=. ((_1}.pp~:1|.pp),1) <;.2 profiles
)
 SELECT cl_lname, cl_title, pp_year, pp_id, pr_mfd, pr_price
  FROM (price_profiles INNER JOIN prices ON pp_id = pr_pp)
   INNER JOIN (clients INNER JOIN revs ON cl_id = rv_client)
    ON pp_id = rv_pp
  WHERE cl_id=? AND rv_validuntil Is Null
  ORDER BY cl_lname, pr_mfd;
)
 
FYI,
 
-- 
Raul

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to