[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Grupowanie



Dzien dobry,

Przy zalaozeniu, ze np. 301-1-10-111 to jedno pole o nazwie klucz,
mozna sprobowac:

for each rekord
   break by substring(klucz,1,3)
   break by substring (klucz, (length(klucz) - 2,3) :
........

Bedzie to dosyc wolne oczywiscie, bo pewnie nie ma indeksu, ktory to wspomaga.
Zeby przyspieszyc, nalezaloby
zrobic dwa pola (poczatek i koniec klucza) oraz dwa indeksy - kazdy wg jednego
z tych pol; i przerobic powyzszy FOR EACH na grupowanie wg tych pol, a nie wg
wyrazen z SUBSTRING.
Pozdrawiam,
Marek Prokop

PS. Przy okazji fragment dokumentacji Progressa:

SUBSTRING (source , position [ , length [ , type ] ] )

source

A character expression from where you want to extract characters or bytes.

position

An integer expression that indicates the position of the first character you
want to extract from source.

length

An integer expression that indicates the number of characters you want to
extract from source. If you do not use the length argument or specify -1 as the
length, SUBSTRING uses the remainder of the string from the specified position.

type

A character expression that directs Progress to interpret the specified
position and length values as character units, bytes, or columns. A double–byte
character registers as one character unit. By default, Progress interprets the
specified position and length values as character units.

There are FOUR valid types: "CHARACTER," "FIXED," "COLUMN," and "RAW." The
expression "CHARACTER" specifies character units. The expression "FIXED"
specifies that position is in character units and the length is in bytes, but
directs SUBSTRING to yield only whole characters. That is, if the last byte or
bytes represent part of, but not all of, a multi–byte character, these bytes
are excluded. The expression "COLUMN" specifies display or print
character–columns. The expression "RAW" specifies bytes. If you specify the
type as a constant expression, Progress validates the type specification at
compile time. If you specify the type as a non–constant expression, Progress
validates the type specification at run time.



Beata Lebryk wrote:

> Witam. Mam pewien problem. Posiadam w bazie np. takie rekordy:
>
> 301-1-10-111    10 zł
> 301-1-12-111    20 zł
> 302-1-10-111    30 zł
> 302-1-12-112    40 zł
> 303-1-12-115    50 zł
> 303-1-15-115    60 zł
>
> Muszę pogrupować dane, ale w ten sposób aby uzyskać wyniki:
> 301-*-**-111    30 zł
> 302-*-**-111    30 zł
> 302-*-**-112    40 zł
> 303-*-**-115    110 zł
>
> Chodzi mi więc o uzyskanie kwot po grupowaniu wg 3 pierwszych cyfr i trzech
> ostatnich. Może to banalne pytanie, ale jak to uzyskać ?
>
> Z góry dziękuję za pomoc.
>
> Pozdrawiam
> Beata Lebryk
>
> ------
> Strona WWW:     http://pluton.pol.lublin.pl/pugpl/index.htm
> Obsluga listy:  listserv@zeto.bydgoszcz.pl
> Archiwum listy: http://www.zeto.bydgoszcz.pl/progress/index.html
> ------

------
Strona WWW:     http://pluton.pol.lublin.pl/pugpl/index.htm
Obsluga listy:  listserv@zeto.bydgoszcz.pl
Archiwum listy: http://www.zeto.bydgoszcz.pl/progress/index.html
------