Thanks Chris, I was trying to get around defining a global, but was the solution that I'd gone back to. It would be nice if it was somehow possible to do this!
Ric -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Burke Sent: Wednesday, 14 February 2007 13:44 To: Programming forum Subject: Re: [Jprogramming] Possible to nest multiline noun definition withverb definition? Sherlock, Ric wrote: > I want to define a local multiline noun within a verb. If I put the ')' > for the noun in the first position the verb definition terminates. If > I indent the noun definition lines with a tab, the verb seems to > define OK but when I run it J becomes unresponsive. That is I can > still interact with J (access menus & type stuff), but the menu > commands and (including > exit) and sentences don't seem to execute. > Is this possible or is there another solution? > > > GetPrices=: 4 : 0 > sqlcmd =. 0 : 0 > 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; > ) > profiles=. > _3 {."1 }. y query__db sqlcmd NB. get last three columns > of query 'pp mfd prc'=: |: data NB. assign each column to name > profiles=. ((_1}.pp~:1|.pp),1) <;.2 profiles NB. box profiles by > client > ) This will not work. The first line with only ) will terminate the verb definition. Also, the 0 right argument to : means read from a script or the keyboard, and an explicit definition is neither. It is best to define lengthy multiline nouns as globals, e.g. GetPricesSQL=: 0 : 0 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; ) GetPrices=: 4 : 0 profiles=. > _3 {."1 }. y query__db GetPricesSQL 'pp mfd prc'=: |: data profiles=. ((_1}.pp~:1|.pp),1) <;.2 profiles ) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
