RE: [U2] DCOUNT

2006-01-06 Thread Larry Hiscock
Mark Johnson wrote: 

 REMOVE doesn't give you the MV counter for the associated fields
 by itself. You have to manage separately and hope to keep in sync.
 That's more code.

You can do multiple removes on different MV strings instead of keeping a
counter and referencing the associated fields as RECX,X.

For example:

LOOP

   REMOVE VAR1 FROM REC15 SETTING DELIM
   REMOVE VAR2 FROM REC16 SETTING NOTHING
   ...

   { do something with the variables }

WHILE DELIM REPEAT


Larry Hiscock
Western Computer Services

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.12/220 - Release Date: 1/3/2006
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] DCOUNT

2006-01-06 Thread Symeon Breen
If we where obj orientated we could have REC15.dcount but alas no 



On 1/6/06, Larry Hiscock [EMAIL PROTECTED] wrote:
 Mark Johnson wrote:

  REMOVE doesn't give you the MV counter for the associated fields
  by itself. You have to manage separately and hope to keep in sync.
  That's more code.

 You can do multiple removes on different MV strings instead of keeping a
 counter and referencing the associated fields as RECX,X.

 For example:

 LOOP

REMOVE VAR1 FROM REC15 SETTING DELIM
REMOVE VAR2 FROM REC16 SETTING NOTHING
...

{ do something with the variables }

 WHILE DELIM REPEAT


 Larry Hiscock
 Western Computer Services

 --
 No virus found in this outgoing message.
 Checked by AVG Free Edition.
 Version: 7.1.371 / Virus Database: 267.14.12/220 - Release Date: 1/3/2006
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] DCOUNT

2006-01-06 Thread Anthony Dzikiewicz
This is the way we always do it. 
For associations, you might be better off creating a separate set of
subroutines that add and delete to rows of associated values.  Its just
more controlled and you dont end of with uneven columns of data.  The
system Im working was not designed this way and I was finding tables of
data within records that were uneven.  We still have a little of that
left and I plan to knock that out when we can.
Anthony

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Johnson
Sent: Thursday, January 05, 2006 12:22 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] DCOUNT


I'm finding that I'm doing a lot of programming for the processing
through multi-valued attributes.

I'm wondering if the method I'm using is the best way to determine the
last element.

LAST=DCOUNT(REC15,@VM)
FOR I=1 TO LAST
(process something)
NEXT I

There was a REMOVE thread a few months ago and I use that when I expect
that the number of elements could test the patience of the EXTRACTs.
REMOVE doesn't give you the MV counter for the associated fields by
itself. You have to manage separately and hope to keep in sync. That's
more code.

I know that in VB certain object array variables (a list box for
example) has a property for the number of elements. Is there anything in
MV that I'm not aware of for determining the last multi-value that's
easier to type than the DCOUNT expression. I'm looking at reducing my
keystrokes.

Thanks in advance.
Mark Johnson
---
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.1.371 / Virus Database: 267.14.14/222 - Release Date:
1/5/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.14/222 - Release Date:
1/5/2006
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] DCOUNT

2006-01-06 Thread Ross Ferris
But this doesn't save much on the typing front, which apparently is the
real objective of the question :-(

However, with a 'smart' pre-compiler you can achieve your OO objectives,
AND(or) reduce typing. (Of course we have such a beast within our Visage
environment)

There are some other advantages to this pre-compiler approach, like
being able to freely (and easily) change the physical implementation of
something if you DO find that there is a more efficient way to work.

For example your pre-compiler directive may look like this :

vl REC 15 mysub

(I've assumed REALLY short names like vl (for a value loop) to reduce
typing, and that mysub is a reference to an internal subroutine to do
something with the variables)

The initial implementation of vl may initially generate code something
like :

LAST = DCOUNT(REC15,@VM)
FOR I = 1 TO LAST
 GOSUB mysub
NEXT I

which is a saving on the typing front (my favourite is the
select/readnext/read/write loop). Or perhaps (better) with a small
change to mysub

LAST = DCOUNT(REC15,@VM)
FOR I = 1 TO LAST
 THIS.REC = REC15,I
 GOSUB mysub
NEXT I

Our next iteration on the journey may generate this code

TEMP.REC15 = REC15
LAST = DCOUNT(TEMP.REC15,@VM)
FOR I = 1 TO LAST
 THIS.REC15 = REC151,I
 GOSUB mysub
NEXT I

to avoid jumping over the leading 14 attributes every time, and if LAST
was getting big, then we could change the implementation to generate

LOOP
 REMOVE THIS.REC15 FROM REC15 SETTING DELIM
 GOSUB mysub
WHILE DELIM REPEAT

to gain the advantages of REMOVE (internal pointers for where we were up
to in the string)

The nice thing about this approach is that if you DO find a better way
to do something that you do often, it becomes very easy to change it
everywhere in your application.

(You can also have 'implementations' of things that may generate
something other than Basic code, but that is a whole other story -
suffice to say that this snippet technology also powers our
multi-lingual capabilities)

Within the context of our Visage development, by adopting his technique
we have a single source tree that can generate code that is
targeted/optimised for a particular OS  database version  type. Whilst
we can debug with the generated code, we develop at a higher (macro)
level

Maybe a long way off topic, but if you are serious about reducing
keystrokes, as part of our Active Code Reduction initiative we have
found that using this type of technique, a single high level
pre-compiler directive may generate 5-50 (or more) lines of efficient,
error-free, local-standards compliant code, resulting in faster
development, and easier maintenance  enhancements



Ross Ferris
Stamina Software
Visage  Better by Design!
-Original Message-
From: [EMAIL PROTECTED] [mailto:owner-u2-
[EMAIL PROTECTED] On Behalf Of Symeon Breen
Sent: Friday, 6 January 2006 10:25 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] DCOUNT

If we where obj orientated we could have REC15.dcount but alas no




On 1/6/06, Larry Hiscock [EMAIL PROTECTED] wrote:
 Mark Johnson wrote:

  REMOVE doesn't give you the MV counter for the associated fields
  by itself. You have to manage separately and hope to keep in sync.
  That's more code.

 You can do multiple removes on different MV strings instead of
keeping a
 counter and referencing the associated fields as RECX,X.

 For example:

 LOOP

REMOVE VAR1 FROM REC15 SETTING DELIM
REMOVE VAR2 FROM REC16 SETTING NOTHING
...

{ do something with the variables }

 WHILE DELIM REPEAT


 Larry Hiscock
 Western Computer Services
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] DCOUNT

2006-01-06 Thread TPellitieri
Mark Johnson [EMAIL PROTECTED] wrote on Thu, 5 Jan 2006 00:21:37
-0500

 I'm finding that I'm doing a lot of programming for the processing
 through multi-valued attributes.

 I'm wondering if the method I'm using is the best way to determine
 the last element.

 LAST=DCOUNT(REC15,@VM)
 FOR I=1 TO LAST
  (process something)
 NEXT I

If you're working with ASSOCIATED multi-values and you need to process
every one, this may be your best bet, although there are some other
options.

If you just need to process each item in a single multi-valued attribute
(without updating the original), you could consider:

REC15 = RAISE(REC15)
SELECT REC15 TO R15.LIST
LOOP WHILE READNEXT MV FROM R15.LIST DO
  (process MV)
REPEAT

For example, I use the above syntax to process each line in a sales order,
where the multi-value in the order header contains the keys to the
individual line items.

If your controlling multi-value is sorted and you only need to process a
known value, you can use the LOCATE function to find the appropriate spot.
With associated multi-values, you'll need to use the INSERT (or DELETE)
function on the associated items to add (or remove) value groups from the
list.  Note that these functions are flavor dependent.

--Tom Pellitieri
  Toledo, Ohio
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] DCOUNT

2006-01-06 Thread Serguei
I personally would even write it like this if I am sure the number of values
is no more then ten:
FOR I=1 TO DCOUNT(REC15,@VM)

(and of course I would not use number as a field position)


- Original Message - 
From: Mark Johnson [EMAIL PROTECTED]
To: u2-users@listserver.u2ug.org
Sent: Thursday, January 05, 2006 5:21 AM
Subject: [U2] DCOUNT


 I'm finding that I'm doing a lot of programming for the processing through
 multi-valued attributes.

 I'm wondering if the method I'm using is the best way to determine the
last
 element.

 LAST=DCOUNT(REC15,@VM)
 FOR I=1 TO LAST
 (process something)
 NEXT I

 There was a REMOVE thread a few months ago and I use that when I expect
that
 the number of elements could test the patience of the EXTRACTs. REMOVE
doesn't
 give you the MV counter for the associated fields by itself. You have to
 manage separately and hope to keep in sync. That's more code.

 I know that in VB certain object array variables (a list box for example)
has
 a property for the number of elements. Is there anything in MV that I'm
not
 aware of for determining the last multi-value that's easier to type than
the
 DCOUNT expression. I'm looking at reducing my keystrokes.

 Thanks in advance.
 Mark Johnson
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] DCOUNT

2006-01-06 Thread Bob Woodward
Correct me if I'm wrong but does this method not require the DCOUNT
function to be executed each iteration of I to determine if you have
reached your max value?  Granted, for a small number of values it would
not be that much of a hit but I'd not like to encourage this on the off
chance that you use it on a large number of values somewhere else.

BobW
 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Serguei
Sent: Friday, January 06, 2006 6:02 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] DCOUNT

I personally would even write it like this if I am sure the number of
values
is no more then ten:
FOR I=1 TO DCOUNT(REC15,@VM)

(and of course I would not use number as a field position)
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] DCOUNT

2006-01-06 Thread Marilyn Hilb
Which is why he said no more than ten. 

 -Original Message-
From:   [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]  On Behalf Of Bob Woodward
Sent:   Friday, January 06, 2006 10:43 AM
To: u2-users@listserver.u2ug.org
Subject:RE: [U2] DCOUNT

Correct me if I'm wrong but does this method not require the DCOUNT
function to be executed each iteration of I to determine if you have
reached your max value?  Granted, for a small number of values it would
not be that much of a hit but I'd not like to encourage this on the off
chance that you use it on a large number of values somewhere else.

BobW
 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Serguei
Sent: Friday, January 06, 2006 6:02 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] DCOUNT

I personally would even write it like this if I am sure the number of
values
is no more then ten:
FOR I=1 TO DCOUNT(REC15,@VM)

(and of course I would not use number as a field position)
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] DCOUNT

2006-01-06 Thread gerry-u2ug
Absolutely correct 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bob Woodward
Sent: January 6, 2006 11:43
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] DCOUNT

Correct me if I'm wrong but does this method not require the DCOUNT
function to be executed each iteration of I to determine if you have
reached your max value?  Granted, for a small number of values it would
not be that much of a hit but I'd not like to encourage this on the off
chance that you use it on a large number of values somewhere else.

BobW
 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Serguei
Sent: Friday, January 06, 2006 6:02 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] DCOUNT

I personally would even write it like this if I am sure the number of
values is no more then ten:
FOR I=1 TO DCOUNT(REC15,@VM)

(and of course I would not use number as a field position)
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] DCOUNT

2006-01-06 Thread Kevin King
I'd like to second BobW in NOT using DCOUNT in a FOR line.  Certainly
when the count is small the overhead is also small, but how many times
are we DCOUNTing with certainty that we know the count is less than a
particular threshold?  Whether the count is zero or higher, I believe
it's always better to assign the count to a variable and then loop to
the variable; then there's no chance for surprises when the program
does encounter an unexpectedly big list.

Furthermore, at the risk of offending delicate sensibilities, I take
this a step farther and recommend specific variable names for FOR
statements.  If the list is in a variable called INVOICES, the loop
would be:

INVOICES.CNT = DCOUNT(INVOICES,@VM)
FOR INVOICES.LOOP = 1 TO INVOICES.CNT
..
NEXT INVOICES.LOOP

(That is, loop variables always end in .LOOP, loop max counts always
end in .CNT, and the prefix is the original variable name.  It has
been my experience that tying the loop max and loop counter to the
original variable name (by convention) improves the clarity and
purpose of the loop.  Your individual results may vary.)

This is assuming, of course, that the FOR/NEXT loop is the proper
construct for the particular task at hand.  If the list is anticipated
to be large or there are other extenuating circumstances due to the
format of the data being looped through, FOR/NEXT may not be the best
choice.

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


RE: [U2] DCOUNT

2006-01-06 Thread BNeylon
IMHO it is a bad habit to get into. 

Bruce M Neylon
Health Care Management Group 





Marilyn Hilb [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
01/06/2006 12:07 PM
Please respond to u2-users

 
To: u2-users@listserver.u2ug.org
cc: 
Subject:RE: [U2] DCOUNT

Which is why he said no more than ten. 

 -Original Message-
From:[EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED]  On Behalf Of Bob Woodward
Sent:Friday, January 06, 2006 10:43 AM
To:  u2-users@listserver.u2ug.org
Subject: RE: [U2] DCOUNT

Correct me if I'm wrong but does this method not require the DCOUNT
function to be executed each iteration of I to determine if you have
reached your max value?  Granted, for a small number of values it would
not be that much of a hit but I'd not like to encourage this on the off
chance that you use it on a large number of values somewhere else.

BobW
 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Serguei
Sent: Friday, January 06, 2006 6:02 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] DCOUNT

I personally would even write it like this if I am sure the number of
values
is no more then ten:
FOR I=1 TO DCOUNT(REC15,@VM)

(and of course I would not use number as a field position)
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] DCOUNT

2006-01-06 Thread Mark Johnson
Thanks for all that responded.

It was not a trick or underhanded question. It was just one of those days
when I had programmed DCOUNT about a zillion times and I was wondering if
there was any shortcut. It's better than the COUNT function that actually
counts something different.

I agree that having FOR I=1 to DCOUNT is not a problem with the small counts
but dare not consider it as my conscience (the U2 Forum) would frown on it.

I've learned a lot from this forum despite my decades of experience as I
have not transversed every possible style of coding. My personal collection
of styles is gleened from that vast experience of inheriting both good and
bad code examples and keeping the best.

Thanks
Mark Johnson
- Original Message -
From: Bob Woodward [EMAIL PROTECTED]
To: u2-users@listserver.u2ug.org
Sent: Friday, January 06, 2006 11:42 AM
Subject: RE: [U2] DCOUNT


 Correct me if I'm wrong but does this method not require the DCOUNT
 function to be executed each iteration of I to determine if you have
 reached your max value?  Granted, for a small number of values it would
 not be that much of a hit but I'd not like to encourage this on the off
 chance that you use it on a large number of values somewhere else.

 BobW

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Serguei
 Sent: Friday, January 06, 2006 6:02 AM
 To: u2-users@listserver.u2ug.org
 Subject: Re: [U2] DCOUNT

 I personally would even write it like this if I am sure the number of
 values
 is no more then ten:
 FOR I=1 TO DCOUNT(REC15,@VM)

 (and of course I would not use number as a field position)
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


[U2] re: [u2] DCOUNT

2006-01-06 Thread Stuart Boydell

Haven't seen anyone mention vector functions here. Do many people use them?

In situations where you are performing identical operations on every 
value in a dynamic array, I rekon vector functions are a more efficient 
way of handling multivalues then dcount/loop constructs.


A simple example of adding 1 to every attribute; instead of:

   max = dcount(var15,@vm)
   for i = 1 to max
  var15,i += 1
   next

you  use:

   var15 = adds(var15,reuse(1))

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


Re: [U2] DCOUNT

2006-01-05 Thread Bruce Nichol

Goo'day, Mark,

At 00:21 05/01/06 -0500, you wrote:


I'm finding that I'm doing a lot of programming for the processing through
multi-valued attributes.

I'm wondering if the method I'm using is the best way to determine the last
element.

LAST=DCOUNT(REC15,@VM)
FOR I=1 TO LAST
(process something)
NEXT I

There was a REMOVE thread a few months ago and I use that when I expect that
the number of elements could test the patience of the EXTRACTs. REMOVE doesn't
give you the MV counter for the associated fields by itself. You have to
manage separately and hope to keep in sync. That's more code.

I know that in VB certain object array variables (a list box for example) has
a property for the number of elements. Is there anything in MV that I'm not
aware of for determining the last multi-value that's easier to type than the
DCOUNT expression. I'm looking at reducing my keystrokes.


If this is a serious query, might I suggest a water-cooled keyboard?


Thanks in advance.
Mark Johnson
---
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 Anti-Virus.
Version: 7.1.371 / Virus Database: 267.14.13/221 - Release Date: 04/01/06


Regards,

Bruce Nichol
Talon Computer Services
ALBURYNSW 2640
Australia

http://www.taloncs.com.au

Tel: +61 (0)411149636
Fax: +61 (0)260232119

If it ain't broke, fix it till it is! 



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.371 / Virus Database: 267.14.13/221 - Release Date: 04/01/06
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] DCOUNT

2006-01-05 Thread Jim Garratt
Over years experience using pick, uv, sb, sb+ I believe that this is the
best and most controlled way.


Jim Garratt
CTI Logistics Ltd

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Mark Johnson
 Sent: Thursday, 5 January 2006 1:22 PM
 To: u2-users@listserver.u2ug.org
 Subject: [U2] DCOUNT


 I'm finding that I'm doing a lot of programming for the processing through
 multi-valued attributes.

 I'm wondering if the method I'm using is the best way to
 determine the last
 element.

 LAST=DCOUNT(REC15,@VM)
 FOR I=1 TO LAST
 (process something)
 NEXT I

 There was a REMOVE thread a few months ago and I use that when I
 expect that
 the number of elements could test the patience of the EXTRACTs.
 REMOVE doesn't
 give you the MV counter for the associated fields by itself. You have to
 manage separately and hope to keep in sync. That's more code.

 I know that in VB certain object array variables (a list box for
 example) has
 a property for the number of elements. Is there anything in MV
 that I'm not
 aware of for determining the last multi-value that's easier to
 type than the
 DCOUNT expression. I'm looking at reducing my keystrokes.

 Thanks in advance.
 Mark Johnson
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/