dbTalk Databases Forums  

Synonym for last multivalue

comp.databases.pick comp.databases.pick


Discuss Synonym for last multivalue in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
johnmarshall (AT) xtra (DOT) co.nz
 
Posts: n/a

Default Synonym for last multivalue - 08-05-2006 , 01:27 AM






Hi

I remember seeing a tip somewhere years ago on a website for a really
simple synonym which found the last multivalue in a multivalued field,
it did it straight off without invoking any subroutine. Can someone
advise me of the syntax required please.

regards

John Marshall


Reply With Quote
  #2  
Old   
Mike Preece
 
Posts: n/a

Default Re: Synonym for last multivalue - 08-05-2006 , 03:04 AM







johnmarshall (AT) xtra (DOT) co.nz wrote:
Quote:
Hi

I remember seeing a tip somewhere years ago on a website for a really
simple synonym which found the last multivalue in a multivalued field,
it did it straight off without invoking any subroutine. Can someone
advise me of the syntax required please.

regards

John Marshall
Google's good. I found this by googling cdp for "last mv"...

http://tinyurl.com/jcszg



Reply With Quote
  #3  
Old   
johnmarshall (AT) xtra (DOT) co.nz
 
Posts: n/a

Default Re: Synonym for last multivalue - 08-05-2006 , 04:36 AM



Mike

thanks for the link. I'd searched Google on the web for the answer but
had not thought of CDP - duh!

Anyway, I tried what was recommended and it works great.

thanks

John
Quote:
Mike Preece wrote:
Quote:
johnmarshall (AT) xtra (DOT) co.nz wrote:
Hi

I remember seeing a tip somewhere years ago on a website for a really
simple synonym which found the last multivalue in a multivalued field,
it did it straight off without invoking any subroutine. Can someone
advise me of the syntax required please.

regards

John Marshall

Google's good. I found this by googling cdp for "last mv"...

http://tinyurl.com/jcszg


Reply With Quote
  #4  
Old   
Luke Webber
 
Posts: n/a

Default Re: Synonym for last multivalue - 08-05-2006 , 09:48 AM



johnmarshall (AT) xtra (DOT) co.nz wrote:
Quote:
Mike

thanks for the link. I'd searched Google on the web for the answer but
had not thought of CDP - duh!

Anyway, I tried what was recommended and it works great.
AS slimy hacks go, yeah. I find it difficult to actually approve of it,
however. Fortunately I've never had to use it myself, because I'd
probably have to scrub like Lady Macbeth afterwards. ;^)

Luke


Reply With Quote
  #5  
Old   
murthi
 
Posts: n/a

Default Re: Synonym for last multivalue - 08-05-2006 , 09:51 AM



Tut, Mike, you're not following established cdp standards, which require you
to say:

'I found this by googling cdp for "last mv"...'

but NOT give the url. Don't make it too easy for John!

Chandru Murthi
ref : news:mmm4d2pnk3er60oscd1red2norlarafpea (AT) 4ax (DOT) com

"Mike Preece" <michael (AT) preece (DOT) net> wrote

Quote:
johnmarshall (AT) xtra (DOT) co.nz wrote:
Hi

I remember seeing a tip somewhere years ago on a website for a really
simple synonym which found the last multivalue in a multivalued field,
it did it straight off without invoking any subroutine. Can someone
advise me of the syntax required please.

regards

John Marshall

Google's good. I found this by googling cdp for "last mv"...

http://tinyurl.com/jcszg




Reply With Quote
  #6  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: Synonym for last multivalue - 08-05-2006 , 01:07 PM



"Mike Preece" wrote:

Quote:
johnmarshall wrote:
I remember seeing a tip somewhere years ago on a website for a really
simple synonym which found the last multivalue in a multivalued field,
it did it straight off without invoking any subroutine. Can someone
advise me of the syntax required please.

Google's good. I found this by googling cdp for "last mv"...
http://tinyurl.com/jcszg
(gotta love tinyurl...)

RE: Syntax:
f;3r
or f;3;p;s;_
or F;{atb};{atb};S;_

This is one of those things that we know works but for my entire
career I've avoided asking exactly why it works. I really want to
understand what's happening here. Though as Luke suggests I would
itch terribly if I ever used it because it's not documented and
subject to break in any release on any platform.

Can some guru please provide some insight into exactly what makes this
syntax tick? I think Henry could write a couple pages on this. Jon,
I don't suppose you could prod him to make a guest appearance?
Chandru, was this something of yours or Tim's?

Thanks!
T


Reply With Quote
  #7  
Old   
Tom Phillips
 
Posts: n/a

Default Re: Synonym for last multivalue - 08-05-2006 , 02:44 PM



I'm currently on a Linux/Universe 10.1.4 (pick format) system.
f;3;p;s;_ on this release returns all of the multivalues.
f;3;s;p;_ returns a sum of the numeric data elements (ignoring non-numerics)
The results are the same for "3r".
Confused ... what versions/systems does this work on?

"Tony Gravagno" <g6q3x9lu53001 (AT) sneakemail (DOT) com.invalid> wrote

Quote:
"Mike Preece" wrote:

johnmarshall wrote:
I remember seeing a tip somewhere years ago on a website for a really
simple synonym which found the last multivalue in a multivalued field,
it did it straight off without invoking any subroutine. Can someone
advise me of the syntax required please.

Google's good. I found this by googling cdp for "last mv"...
http://tinyurl.com/jcszg

(gotta love tinyurl...)

RE: Syntax:
f;3r
or f;3;p;s;_
or F;{atb};{atb};S;_

This is one of those things that we know works but for my entire
career I've avoided asking exactly why it works. I really want to
understand what's happening here. Though as Luke suggests I would
itch terribly if I ever used it because it's not documented and
subject to break in any release on any platform.

Can some guru please provide some insight into exactly what makes this
syntax tick? I think Henry could write a couple pages on this. Jon,
I don't suppose you could prod him to make a guest appearance?
Chandru, was this something of yours or Tim's?

Thanks!
T



Reply With Quote
  #8  
Old   
Luke Webber
 
Posts: n/a

Default Re: Synonym for last multivalue - 08-05-2006 , 05:57 PM



Tom Phillips wrote:
Quote:
I'm currently on a Linux/Universe 10.1.4 (pick format) system.
f;3;p;s;_ on this release returns all of the multivalues.
f;3;s;p;_ returns a sum of the numeric data elements (ignoring non-numerics)
The results are the same for "3r".
Confused ... what versions/systems does this work on?
D3 and its predecessors, AP, R83 and all their various avatars
(Ultimate, mvBase, mvEnterprise etc).

Luke


Reply With Quote
  #9  
Old   
Mark Brown
 
Posts: n/a

Default Re: Synonym for last multivalue - 08-05-2006 , 05:59 PM



"Tony Gravagno" <g6q3x9lu53001 (AT) sneakemail (DOT) com.invalid> wrote in message
Quote:
(gotta love tinyurl...)

RE: Syntax:
f;3r
or f;3;p;s;_
or F;{atb};{atb};S;_

This is one of those things that we know works but for my entire
career I've avoided asking exactly why it works. I really want to
understand what's happening here. Though as Luke suggests I would
itch terribly if I ever used it because it's not documented and
subject to break in any release on any platform.

Can some guru please provide some insight into exactly what makes this
syntax tick? I think Henry could write a couple pages on this. Jon,
I don't suppose you could prod him to make a guest appearance?
Chandru, was this something of yours or Tim's?

Thanks!
T
Mr T,

I may have this backwards; it's been years since I've seen the source code.

When you're attempting to match up values in attributes that might not have
the same number of values, there are several things you need to be able to
do:

(R) repeat one value against all the values of another attribute. For
example, to concatenate a single valued "prefix" to multivalues to make a
remote key, something like this: f;1r;2;: repeats the single value in att1
with each value in attribute 2

(S) Sum all the values, run thru the values of an attribue and accumulate a
single value.

(P) Push a value from the stack onto the stack

(_) Swap two values on the stack.

So f;3r probably pushes the first value onto the stack and repeats it as
required and since it's only required once, that's the one you get.
f;3;p;s;_ pushes the value onto the stack(3), pushes the top value again
(p), performs a sum which pushes a "total" onto the stack (s) and then swaps
the two top values leaving that (P)ushed value now on top of the stack.

The stack is like the little plastic coin holders they have for people who
do a lot of tolls. You push coins into the top and you pop them out the
top. Each "command" code (eg. +, -, :, etc) pops as many items off the
stack as required and pushes the answer back. So f;3;4;+ pushes attr 3,
pushes attr 4; then the + pops off two values, adds them togethe and pushes
the answer back.

The problem with these correlatives is that they leave unwanted/unused items
on the stack, like the f;3;p;s;_ will leave the sum on the stack, probably 0
if the attribute is non-numeric. With systems that have limited stack
space, that can be a problem.

Mark




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.