I use this technique so often, I wrote a called subroutine to turn a 
comma-separated list into an ordered dynamic array.  It changes commas to @AM, 
trims each entry and sorts the list before returning it.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tony Gravagno
Sent: Saturday, March 17, 2007 4:39 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] SELECT.LIST, DCOUNT and @VM

Colin Jennings wrote:
> Don't know why without looking at the rest of the code, but some 
> people prefer to build a comma-separated list and then change the 
> commas to system delimiters rather than delimit with @VM in the first 
> place.  Not wrong, but perhaps a bit unnecessary.  Does make the code 
> easier to read I suppose.

(I know this is all real fundamental for many people here, but I hope it helps 
some beginners.)

I do that a lot with commas or spaces.  Sometimes it's not practical to create 
a separate item which must be read to provide the static data. When there is a 
need to build an array (especially those with more than just a few attributes 
and/or values) it does't make sense to me to have many lines like this:
  INFO = 'NAME'
  INFO<1,-1> = 'TELEPHONE'
  INFO<1,-1> = 'ADDRESS'
when it can be summarized into:
  INFO = 'NAME TELEPHONE ADDRESS'
  CONVERT ' ' TO @VM IN INFO
Text wrapping in editors makes the info readable, and we don't need to 
hard-code attributes (see the original post) or values which may require 
modification later.  When the data does not include spaces, I prefer spaces as 
a delimiter to induce text wrapping in the code, compared to commas which will 
cause weird breaking depending on which editor is used.  The code can also be 
broken down for printing or Emailing as follows:
  BLOCK = 'NAME TELEPHONE EMAIL FAX'
  BLOCK := ' ADDR1 ADDR2 CITY PROVINCE COUNTRY ...'
  INFO<-1> = BLOCK

The code posted by the OP has a problem:
> SELECT.LIST<1> = 'NAME, TELEPHONE, ADDRESS'
> SELECT.LIST<2> = 'NAME, TELEPHONE, CITY'
> SELECT.LIST<3> = 'NAME, TELEPHONE, OFFICE'
> CONVERT ',' TO @VM IN SELECT.LIST
> SELECT.CNT = DCOUNT( SELECT.LIST<1>, @VM )

That results in embedded leading spaces in the data.  Maybe this was just an 
example.  I use commas OR spaces, rarely both, and then the final dynamic array 
needs to be TRIMmed.



T
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.13/725 - Release Date: 3/17/2007 
12:33 PM
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.13/725 - Release Date: 3/17/2007 
12:33 PM
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to