Claudine ,Sami, Jay:
Actually there are three issues that need to be considered:
One, if the returns objects have blanks, each value has to be surrounded by
quotes.
Two, if the objects have embedded commas, the objects also have to be
embedded by quotes.
Three, if the object contains embedded ' (quote) such as O'Neal.
I have CHOOSE that selects employee names that are in the format "Last_name,
First_initial" which includes both of the conditions above.
Normally the return variable would have the following format:
SHOW VAR vreq
vreq               = 'Allen, F,Brown, T,Cross, J,Davis, S,O'Neill, J'
Obviously a string replacement would not work...
Here is a snippet of code that uses the CHOOSE command to select up to 30
employees whose names include all three conditions above (thanks Larry
Lustig for the help):

CHOOSE vreq FROM #VALUES FOR +
DISTINCT pt_requestor,(''''+ SRPL(pt_requestor, '''', '''''', 0)+'''') +
FROM parts_trans_file WHERE po_no like 'CARRY%' CHKBOX 30 +
TITLE 'AVAILABLE REQUESTORS' +
CAPTION 'Select up to 30 Requestors...' LINES 20 +
OPTION LIST_FONT_NAME Courier New |+
TITLE_FONT_NAME Courier New |+
TITLE_FONT_COLOR BLUE |+
CAPTION_FONT_NAME Courier New

The result comes all parsed as follows:
SHOW VAR vreq
vreq               = 'Allen, F','Brown, T','Cross, J','Davis, S','O''Neill,
J'

Now, all I have to do is put parentheses around the expression:

SET VAR vreq = ('(' + .vreq + ')')

And print the report

PRINT my_report WHERE pt_requestor IN &vreq +
ORDER BY my_order clause +
OPTION SCREEN|Window_State MAXIMIZED

And, as R:azzak would say, that's all there is to it. I hope the information
is of help.
Javier,

Javier Valencia, PE
President
Valencia Technology Group, L.L.C.
14315 S. Twilight Ln, Suite #14
Olathe, Kansas 66062-4578
Office (913)829-0888
Fax (913)649-2904
Cell (913)915-3137
================================================
Attention:
The information contained in this message and or attachments is intended
only for the person or entity to which it is addressed and may contain
confidential and/or privileged material.  Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon,
this information by persons or entities other than the intended recipient
is prohibited. If you received this in error, please contact the sender and
delete the material from all system and destroy all copies.
======================================================

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] Behalf Of Sami Aaron
Sent: Thursday, January 13, 2005 10:36 AM
To: RBG7-L Mailing List
Subject: [RBG7-L] - RE: Choose Variable Usage

Jay -

Technically, I think you are correct - but from my experience, if there are
no spaces within any of the values, then it works fine without the
surrounding quotes.

If there were spaces, then I would do this:

SET V varname =   'D04 0975,D04 0976,D04 0977,D04 0978,D04 0991,D04 0992,D04
0993,D04 0998'


--Add beginning and ending quotes and starting and ending parens
SET V varname = ('(''' + .varname + ''')')

--search/replace all commas with quote-comma-quote
SET V varname = (SRPL(.varname,',',''',''',0))

That changes the final variable to be:
('D04 0975','D04 0976','D04 0977','D04 0978','D04 0991','D04 0992','D04
0993','D04 0998')

Sami


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of J BLAUSTEIN
Sent: Thursday, January 13, 2005 8:56 AM
To: RBG7-L Mailing List
Subject: [RBG7-L] - RE: Choose Variable Usage

if the field is text - does the individual invoice number have to be
inclosed with a " ' " for the IN command to work ?
J

At 11:14 AM 1/13/2005, you wrote:
>set var varname =
>'D04-0975,D04-0976,D04-0977,D04-0978,D04-0991,D04-0992,D04-0993,D04-0998
>,D04-0999,D04-1008,D04-1011,D04-1017,D04-1018,D04-1019,D04-1020,D04-1021
>,D04-1027,D04-1029,D04-1036,D04-1043'
>
>sho v varname
>
>D04-0975,D04-0976,D04-0977,D04
>-0978,D04-0991,D04-0992,D04-09
>93,D04-0998,D04-0999,D04-1008,
>D04-1011,D04-1017,D04-1018,D04
>-1019,D04-1020,D04-1021,D04-10
>27,D04-1029,D04-1036,D04-1043
>
>
>choose vchoice from #list .varname title 'Pick Invoice' caption 'Test
>Choose' lines 12 formatted
>
>Did not use check box or options on this choose command.
>
>Best regards,
>
>Oma Cox
>
>
>-----Original Message-----
>From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Claudine
>Robbins
>Sent: Wednesday, January 12, 2005 10:51 PM
>To: RBG7-L Mailing List
>Subject: [RBG7-L] - Choose Variable Usage
>
>
>I just discovered the cool choose command to return a list of data.
>This is my variable for a list of paid invoices:
>
>R>sho v varname
>D04-0975,D04-0976,D04-0977,D04
>-0978,D04-0991,D04-0992,D04-09
>93,D04-0998,D04-0999,D04-1008,
>D04-1011,D04-1017,D04-1018,D04
>-1019,D04-1020,D04-1021,D04-10
>27,D04-1029,D04-1036,D04-1043
>
>Now, how can I use the data?

Reply via email to