Home > Archive > Clipper > March 2004 > comining 2 indexes inside 1 view
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
comining 2 indexes inside 1 view
|
|
| hpy_awad@yahoo.com 2004-03-26, 10:58 pm |
| I am trying to reach an view sorted by character field but ended by a
numeric character such as . MY field data looks like that :
AUC2
IDSC3
AUC1
IDSC1
AUC5
IDSC2
AUC3
IDSC4
IDSC5
AUC4
I want my view (dbedit) looks sorted in such way :
AUC1
AUC2
AUC3
AUC4
AUC5
IDSC1
IDSC2
IDSC3
IDSC4
IDSC5
But if I have IDSC10 it comes following to IDSC1 . How can I make
index file sorted based on charater value then index then resort
according to numeric vlaue . I may put both of them in separate fields
..
What a soultion to that problem ?
I am using clipper5 5.01 under Dos (NewPIE) ?
| |
| Ross McKenzie 2004-03-26, 10:58 pm |
| On 15 Mar 2004 03:10:19 -0800, ehab_aziz2001@yahoo.com
(hpy_awad@yahoo.com) wrote:
>I am trying to reach an view sorted by character field but ended by a
>numeric character such as . MY field data looks like that :
>
>AUC2
>IDSC3
>AUC1
>IDSC1
>AUC5
>IDSC2
>AUC3
>IDSC4
>IDSC5
>AUC4
>
>I want my view (dbedit) looks sorted in such way :
>
>AUC1
>AUC2
>AUC3
>AUC4
>AUC5
>IDSC1
>IDSC2
>IDSC3
>IDSC4
>IDSC5
>
>
>But if I have IDSC10 it comes following to IDSC1 . How can I make
>index file sorted based on charater value then index then resort
>according to numeric vlaue . I may put both of them in separate fields
>.
>
>What a soultion to that problem ?
>
>I am using clipper5 5.01 under Dos (NewPIE) ?
Hi,
Is the last alpha before the numeric always "C" as in your examples?
Regards,
Ross McKenzie
ValuSoft
Melbourne Australia
valusoft AT optushome DOT com DOT au
| |
| Frank Demont 2004-03-26, 10:58 pm |
|
You have to give the second part from the index a fix length :
FIELD1 Character
FIELD2 Digits , character field ?
INDEX ON FIELD1 + PADL(ALLTRIM(Field2) , LEN(Field2) , "0"))
If FIeld2 is numeric , it could be :
PADL(LTRIM(STR(VAL(Field2))) , desired length , "0")
Frank
"hpy_awad@yahoo.com" <ehab_aziz2001@yahoo.com> schreef in bericht
news:7ecaee57.0403150310.1b04d90d@posting.google.com...
> I am trying to reach an view sorted by character field but ended by a
> numeric character such as . MY field data looks like that :
>
> AUC2
> IDSC3
> AUC1
> IDSC1
> AUC5
> IDSC2
> AUC3
> IDSC4
> IDSC5
> AUC4
>
> I want my view (dbedit) looks sorted in such way :
>
> AUC1
> AUC2
> AUC3
> AUC4
> AUC5
> IDSC1
> IDSC2
> IDSC3
> IDSC4
> IDSC5
>
>
> But if I have IDSC10 it comes following to IDSC1 . How can I make
> index file sorted based on charater value then index then resort
> according to numeric vlaue . I may put both of them in separate fields
> .
>
> What a soultion to that problem ?
>
> I am using clipper5 5.01 under Dos (NewPIE) ?
| |
| hpy_awad@yahoo.com 2004-03-26, 10:58 pm |
| No . They are abbreivations to library codes. They may be:
ITI1,2,3,..
HTI-OB1,2,3,..
HTI-NB1,2,3,..
etc...
| |
| Ross McKenzie 2004-03-26, 10:58 pm |
| On 15 Mar 2004 06:28:49 -0800, ehab_aziz2001@yahoo.com
(hpy_awad@yahoo.com) wrote:
>No . They are abbreivations to library codes. They may be:
>ITI1,2,3,..
>HTI-OB1,2,3,..
>HTI-NB1,2,3,..
>
>etc...
OK, then I would probably use the strzero() to reformat your numeric
section of the library code for the index.
Regards,
Ross McKenzie
ValuSoft
Melbourne Australia
valusoft AT optushome DOT com DOT au
| |
| hpy_awad@yahoo.com 2004-03-26, 10:58 pm |
| It can not be given a fixed length as you see my data , but is there a
function detect a foundation of numeric value inside a string ?
| |
| Stephen Quinn 2004-03-26, 10:58 pm |
|
> It can not be given a fixed length as you see my data , but is there a
When you create your 'key' use strzero() - this is what Ross was saying
Eg
key := 'AUC' + strzero( 1, 2 ) // 'AUC01'
key := 'AUC' + strzero( 2, 2 ) // 'AUC02'
key := 'AUC' + strzero( 3, 2 ) // 'AUC02'
key := 'IDSC' + strzero( 1, 2 ) // 'IDSC01'
key := 'IDSC' + strzero( 2, 2 ) // 'IDSC02'
key := 'IDSC' + strzero( 3, 2 ) // 'IDSC03'
That's about the only way you'll be able to sort/index and have 'IDSC10' in it's proper place.
--
HTH
Steve Quinn
"hpy_awad@yahoo.com" <ehab_aziz2001@yahoo.com> wrote in message
news:7ecaee57.0403160815.195ab591@posting.google.com...
> It can not be given a fixed length as you see my data , but is there a
> function detect a foundation of numeric value inside a string ?
| |
|
| Hi,
"hpy_awad@yahoo.com" <ehab_aziz2001@yahoo.com> a écrit dans le message de
news:7ecaee57.0403160815.195ab591@posting.google.com...
> It can not be given a fixed length as you see my data , but is there a
> function detect a foundation of numeric value inside a string ?
Well, I thing the best way is the following :
1. parse your key, separating the "digit"-parts from the "alpa"-parts
2. pad the "digit"-parts to a sufficient lenght
3. re-assemble the parts to obtain an indexable key
Of course this assume you can add the "patched-for-indexing" field to your
db.
Regards,
Jean-Pierre
|
|
|
|
|