LEVELS correlative

LEVELS correlative

Post by Frank Winan » Thu, 16 Jan 2003 12:40:18



Here's a new tool;  create an item in MD called LEVELS as
follows, and then for any file you can sort/select based on how many
punctuation-delimited fields the item id has.  
Null string item ids have LEVELS of zero,
but  "tom"  and   "dick.harry"  have LEVELS of one and two respectively.

This was only tried on D3/Linux.  It is free software, but it may be broken.
 Use it at your own risk.  

When I omitted the s;*;* output conversion, the List processor seemed to
omit processing the correlative altogether, so
LEVELS showed null string instead of the desired 0.  So leave 007 as-is.

I'd wanted something a bit more selective, but there doesn't seem to be a
processing code to change all "*" to "3", so sadly every character BUT
letters and digits seem to act as field separators.  Which is close enough
for my purposes, I guess.

001 S
002 0
003 L
004
005
006
007 s;*;*
008 aif 0 = '' then '0' else 0(mc/an)(L0)  + '1'
009 r
010 1
011
012
013
014
015
016
017 Dcount of fields in item id. LIST MYFILE "tom*dick.harry" LEVELS says 3

 
 
 

LEVELS correlative

Post by Robert Herbi » Sat, 18 Jan 2003 11:40:02


Frank,

It seems dangerous to me to assume that MC/AN will only leave delimiters.
It would be safer if you knew with certainty that a particular file's
item-ids were delimited with periods, colons, or whatever.  I vote for a
basic call in the dictionary of every file.

Robert Herbin

Quote:> Here's a new tool;  create an item in MD called LEVELS as
> follows, and then for any file you can sort/select based on how many
> punctuation-delimited fields the item id has.
> Null string item ids have LEVELS of zero,
> but  "tom"  and   "dick.harry"  have LEVELS of one and two respectively.

> This was only tried on D3/Linux.  It is free software, but it may be
broken.
>  Use it at your own risk.

> When I omitted the s;*;* output conversion, the List processor seemed to
> omit processing the correlative altogether, so
> LEVELS showed null string instead of the desired 0.  So leave 007 as-is.

> I'd wanted something a bit more selective, but there doesn't seem to be a
> processing code to change all "*" to "3", so sadly every character BUT
> letters and digits seem to act as field separators.  Which is close enough
> for my purposes, I guess.

> 001 S
> 002 0
> 003 L
> 004
> 005
> 006
> 007 s;*;*
> 008 aif 0 = '' then '0' else 0(mc/an)(L0)  + '1'
> 009 r
> 010 1
> 011
> 012
> 013
> 014
> 015
> 016
> 017 Dcount of fields in item id. LIST MYFILE "tom*dick.harry" LEVELS says
3


 
 
 

LEVELS correlative

Post by <fwin.. » Mon, 20 Jan 2003 11:09:42


"Robert Herbin" wrote
Quote:> It seems dangerous to me to assume that MC/AN will only leave delimiters.
> It would be safer if you knew with certainty that a particular file's
> item-ids were delimited with periods, colons, or whatever.  I vote for a
> basic call in the dictionary of every file.

Fair enough.  But why not catalog the subroutine in MD and then use it for
SORTs on any file in that account?  I accepted the hazards since any
application that needs such a dict entry can write one itself on the spot,
btw.
 
 
 

1. assign correlative numbers to records in table

Hi, I want to assign a correlative(increasing) number (starting from 1) to
certain field for each record in a table.

Is there any way to do that?
Which would be the most efficient?

Thanks to anyone  who could help me.
Juan Andres

2. Beginner over his head!

3. Use of Integer in Correlative

4. MDB access (CD access)

5. F Correlative

6. Thanks to James & the Group

7. Correlative question

8. Detroit Area DBA's

9. Help with correlative

10. A or F correlative in BASIC oconv

11. D3 CALL correlative

12. B Correlative

13. What's wrong with my F-correlative?