Sami,
#List and related commands are cool additions to RBW (I'm
looking forward to them <g>). But the point of my post was a no-
brainer approach to limiting literals to those that were relevant.
Also, in my example, the literals were followed by choices from a
table.
For example, in your example,
Add/Edit Customers,Print Reports,Year End Process,Database
Maintenance,Send Tech Support Email,R> Prompt,Exit
"Print reports" and "Year End Process" wouldn't be relevant until
there was data to process, so a union sel against _empty_ tables
that hold those data pieces would exclude those choices from the
menu until something was added.
This is one of those things that doesn't set the world on fire, but
90% of my support burden is ramping up a new customer. The
fewer choices the less confusing for the newbie customer. And this
technique just eliminates a bunch of little routines to accomplish
the same result.
Ben Petersen
On 21 Nov 2002, at 14:08, Sami Aaron wrote:
> Ben -
>
> The new CHOOSE varname FROM #LIST syntax has made this even easier.
> Here is an example
>
>
> SET V vpick TEXT = NULL
> SET VAR vlines INTEGER = NULL
> SET VAR vmenutext TEXT = NULL
> SET V vmenutext = +
> 'Add/Edit Customers,Print Reports,Year End Process,Database
> Maintenance,Send Tech Support Email,R> Prompt,Exit'
> SET VAR vlines = (ITEMCNT(.vmenutext))
> IF vlines > 20 THEN
> SET V vlines = 20
> ENDIF
>
> CHOOSE vpick FROM #LIST .vmenutext +
> AT 12 12 TITLE 'Tower Technology Main Menu' CAPTION .gDatabase LINES
> .vlines IF vpick = 'Exit' THEN
> GOTO bottom
> ENDIF
>
> SWITCH (.vpick)
> CASE 'Add/Edit Customers'
> RUN cust.rmd
> BREAK
>
> CASE 'Print Reports'
> RUN reports.rmd
> BREAK
>
> CASE 'Year End Process'
> RUN yearend.rmd
> BREAK
>
> CASE 'Database Maintenance'
> RUN dbmaint.rmd
> BREAK
>
> CASE 'Send Tech Support Email'
> SET V vemail = ('mailto:[EMAIL PROTECTED]')
> SET V vemail = (.vemail + '&Subject=RBase Tech Help')
> LAUNCH .vemail
> BREAK
>
> CASE 'R> Prompt'
> CLEAR ALL VAR EXCEPT G%
> SET V FCUID INTEGER
> QUIT
> BREAK
>
> ENDSW
>
> This produces a menu option of each item in the list and is the
> easiest menu pick routine I've found yet - and to think, I just kind
> of "borrowed" it from Razzak's samples from the conference ... :)
>
> Sami
>
> -----------------------------------------------------------
> Sami Aaron
> Software Management Specialists
> 19312 W 63rd Terr
> Shawnee KS 66218
> 913-915-1971
> http://www.softwaremgmt.com
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Ben Petersen Sent:
> > Thursday, November 21, 2002 3:47 AM To: [EMAIL PROTECTED]
> > Subject: A Duh Moment
> >
> > This is one of those things I came across recently that had me
> > laughing at myself. Certainly nothing earth shaking, but one of
> > those simple things that helps a bit.
> >
> > I use choose a lot. I also use Bill D's tip for unions to add
> > literal choices to the menu... so forever I've been doing it like
> > this:
> >
> > CHOOSE txtInvID FROM #VALUES FOR +
> > '* Add New Invoice',0 +
> > FROM Dummy WHERE LIMIT = 1+
> > UNION +
> > SELECT '* Purchase on Account', -1 +
> > FROM Dummy WHERE LIMIT = 1 +
> > UNION +
> > SELECT '* Re-display by Name', -2 +
> > FROM Dummy WHERE LIMIT = 1 +
> > UNION +
> > SELECT DISTINCT(CTXT(T1.InvoiceNum)&T2.CusName),TranID
> > FROM ar_InvoiceVW T1, +
> > CusName T2 +
> > WHERE T1.CustomerID = T2.CusID AND +
> > T1.CustSrc = T2.CustSrc +
> > ORDER BY 1 AT 5,1 +
> > TITLE 'Press [Esc] to Quit' +
> > CAPTION Invoices +
> > LINES .vCT
> >
> > This example produces a menu with
> >
> > * Add new Invoice
> > * Purchase on Account
> > * Order by Name
> > [list of invoice#/CusName]
> >
> > But when my customers first start a system I don't want things like
> > "Order by Name" or "Purchase on Account" until there is supporting
> > data to allow a choice (if there are no invoices to sort or
> > customers with approved credit to choose why present the option?).
> > And so I would dutifully do counts and conditional stuff and end up
> > with an accurate menu 10 or 15 lines down the page.
> >
> > What never occurred to me was rather than selecting from my
> > Dummy table I should just base that particular select against the
> > table which holds the supporting data... if there is no data there
> > is no choice in the menu.
> >
> > So ...
> > UNION +
> > SELECT '* Re-display by Name',1 +
> > FROM ar_InvoiceVW WHERE LIMIT = 1 +...
> >
> > now is only included when there are invoices to address.
> >
> > Hope I didn't bore everybody with something this obvious! But
> > maybe there is some poor slob like me out there who can benefit <g>.
> >
> > Ben Petersen
> >
> >
> > ================================================
> > TO SEE MESSAGE POSTING GUIDELINES:
> > Send a plain text email to [EMAIL PROTECTED]
> > In the message body, put just two words: INTRO rbase-l
> > ================================================
> > TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
> > In the message body, put just two words: UNSUBSCRIBE rbase-l
> > ================================================ TO SEARCH ARCHIVES:
> > http://www.mail-archive.com/rbase-l%40sonetmail.com/
> >
> > ================================================
> > TO SEE MESSAGE POSTING GUIDELINES:
> > Send a plain text email to [EMAIL PROTECTED]
> > In the message body, put just two words: INTRO rbase-l
> > ================================================
> > TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
> > In the message body, put just two words: UNSUBSCRIBE rbase-l
> > ================================================ TO SEARCH ARCHIVES:
> > http://www.mail-archive.com/rbase-l%40sonetmail.com/
> >
> >
> >
>
>
> ================================================
> TO SEE MESSAGE POSTING GUIDELINES:
> Send a plain text email to [EMAIL PROTECTED]
> In the message body, put just two words: INTRO rbase-l
> ================================================
> TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In
> the message body, put just two words: UNSUBSCRIBE rbase-l
> ================================================ TO SEARCH ARCHIVES:
> http://www.mail-archive.com/rbase-l%40sonetmail.com/
>
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/