I am trying to share foxPro files with Clipper apps using CDX-compatible drivers. The problem is that the index expressions include function names that are incompatible with FoxPro. Some are easy to fix - the Pad() function can be replaced with PadL() for example. However, the Descend() function allows mixed ascend/descend indexes, such as INDEX ON CUSTCODE + DESCEND(INV_DATE) TO...

As you can guess, this will produce a sort order of ascending costmer codes, but descending invoice dates.

I know how to reproduce the functionality of Descend() in FoxPro by creating a UDF, but I also need to know how to make sure that it is always available every time VFP8 runs - without the user having to explicitly load any procedure files. What is the best practice for this? Also, is it possible to create a DLL or something containing UDF's for index expressions athat can be attached to an ODBC, OLE DB or ADO objects so that other apps using an instance of the FoxPro data engine can also automatically have access to these functions?

TIA

Carlo

Re: UDF's in FoxPro indexes by Rick

Rick
Fri Jun 25 12:35:04 CDT 2004

Carlo,
You could usde something like STR({^9999/12/31}-INV_DATE)) instead of =
DESCEND(INV_DATE).

Rick

"Carlo Stonebanks" <CarloStonebanks@discussions.microsoft.com> wrote in =
message news:A25DC7D8-B9D9-496B-88C7-A2C06BEC888F@microsoft.com...
> I am trying to share foxPro files with Clipper apps using =
CDX-compatible drivers. The problem is that the index expressions =
include function names that are incompatible with FoxPro. Some are easy =
to fix - the Pad() function can be replaced with PadL() for example. =
However, the Descend() function allows mixed ascend/descend indexes, =
such as INDEX ON CUSTCODE + DESCEND(INV_DATE) TO...
>=20
> As you can guess, this will produce a sort order of ascending costmer =
codes, but descending invoice dates.
>=20
> I know how to reproduce the functionality of Descend() in FoxPro by =
creating a UDF, but I also need to know how to make sure that it is =
always available every time VFP8 runs - without the user having to =
explicitly load any procedure files. What is the best practice for this? =
Also, is it possible to create a DLL or something containing UDF's for =
index expressions athat can be attached to an ODBC, OLE DB or ADO =
objects so that other apps using an instance of the FoxPro data engine =
can also automatically have access to these functions?
>=20
> TIA
>=20
> Carlo

Re: UDF's in FoxPro indexes by Josh

Josh
Fri Jun 25 14:02:28 CDT 2004

Why use a udf?

Why not use the DESC keyword?

On Fri, 25 Jun 2004 10:13:06 -0700, "Carlo Stonebanks"
<CarloStonebanks@discussions.microsoft.com> wrote:

>I am trying to share foxPro files with Clipper apps using CDX-compatible drivers. The problem is that the index expressions include function names that are incompatible with FoxPro. Some are easy to fix - the Pad() function can be replaced with PadL() for example. However, the Descend() function allows mixed ascend/descend indexes, such as INDEX ON CUSTCODE + DESCEND(INV_DATE) TO...
>
>As you can guess, this will produce a sort order of ascending costmer codes, but descending invoice dates.
>
>I know how to reproduce the functionality of Descend() in FoxPro by creating a UDF, but I also need to know how to make sure that it is always available every time VFP8 runs - without the user having to explicitly load any procedure files. What is the best practice for this? Also, is it possible to create a DLL or something containing UDF's for index expressions athat can be attached to an ODBC, OLE DB or ADO objects so that other apps using an instance of the FoxPro data engine can also automatically have access to these functions?
>
>TIA
>
>Carlo


---
Remove x's to send.

Re: UDF's in FoxPro indexes by Cindy

Cindy
Fri Jun 25 13:58:07 CDT 2004

In news: A25DC7D8-B9D9-496B-88C7-A2C06BEC888F@microsoft.com,
Carlo Stonebanks <CarloStonebanks@discussions.microsoft.com> wrote:
> ...I know how to reproduce the functionality of Descend() in FoxPro by
> creating a UDF, but I also need to know how to make sure that it is
> always available every time VFP8 runs ...

Hi Carlo,

Are your tables part of a Database Container? (A DBC file is present) If so
you can make the UDF a stored procedure in the DBC and it will automatically
be available.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy.winegarden@mvps.org www.cindywinegarden.com




Re: UDF's in FoxPro indexes by Gene

Gene
Fri Jun 25 16:30:20 CDT 2004

"Rick Bean" <rgbean@unrealmelange-inc.com> wrote:

>You could usde something like STR({^9999/12/31}-INV_DATE)) instead of DESCEND(INV_DATE).
^^^^^^^^^^^^^^^^^^^^^^^
This may not be fixed size. Sloppy code like this will work for,
say, 2920302 days and then mysteriously fail. <BEG> Actually, it
will not work at all because of the extra right paren.

If this is all the index expression is, the str() is not
necessary.

Another approach on the date is
chrtran(dtos(thedate),"0123456789","9876543210")

[snipped previous]

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: UDF's in FoxPro indexes by Jeroen

Jeroen
Sat Jun 26 16:11:51 CDT 2004

On Fri, 25 Jun 2004 10:13:06 -0700, "Carlo Stonebanks"
<CarloStonebanks@discussions.microsoft.com> wrote:

>I am trying to share foxPro files with Clipper apps using CDX-compatible drivers.

The only solution that i could find was to patch the runtime and
development libarry's to 'rename' the function descend() to something
else (in my case I made it desqend())
Somehow this also changes the option word descending to desqending so
now I start every program file with:
#define descending desqending
and make sure I use the complete 'descending' text in the commands:
select ..., set inde to, use ... descending, etc

After finding out the correct locations in the library's it runs like
a charm.

*------------------
* FUNCTION to make a descending index
* make sure all occurrences of 'DESCENDING' in vfp*.* are patched
* to e.g. 'DESQENDING' to remove the internal descend function
* VFP7.EXE offset #F378B change 44 to 51
* VFP7R.DLL offset 0x2FE147 change 44 to 51

*!* Jakub Ridel schrieb in Nachricht
<8chgt6$1re2$1@news.vol.cz>...
*!* >I use Cilpper 5.2 and Six Driver 3. I have complicated
indexes with keys
*!* >like
*!* > "string+str(number,6)+descend(string)". I need to access
them from Windows.
*!* >But common FoxPro 2.6 ODBC driver isn't able to read them.
*!* descend is something you need to write in FoxPro.
*!* It makes xor(string, 0xFE) and nothig more.

PARAMETERS lcTekst
* try simple xor 0xFF && doesnt work, neither 0xFE
PRIVATE lcRes,lnTel,lnAsc
lcRes=''
*lcTekst=TRANSFORM(lcTekst) && hope this works...
FOR lnTel=1 TO LEN(lcTekst)
lnAsc=ASC(SUBSTR(lcTekst,lnTel,1))
IF lnAsc=0
lcRes=lcRes+CHR(0)
ELSE
lcRes=lcRes+CHR(256-lnAsc)
ENDIF
*lcRes = lcRes + CHR(BITXOR(ASC(SUBSTR(lcTekst,lnTel,1)),0xFF))
ENDFOR
RETURN lcRes
*----------------------------
> The problem is that the index expressions include function names that are incompatible with FoxPro.
>Some are easy to fix - the Pad() function can be replaced with PadL() for example. However, the Descend() function
>allows mixed ascend/descend indexes, such as INDEX ON CUSTCODE + DESCEND(INV_DATE) TO...
>
>As you can guess, this will produce a sort order of ascending costmer codes, but descending invoice dates.
>
>I know how to reproduce the functionality of Descend() in FoxPro by creating a UDF, but I also need to know how to make sure that it is always available every time VFP8 runs - without the user having to explicitly load any procedure files. What is the best practice for this? Also, is it possible to create a DLL or something containing UDF's for index expressions athat can be attached to an ODBC, OLE DB or ADO objects so that other apps using an instance of the FoxPro data engine can also automatically have access to these functions?
>
>TIA
>
>Carlo


Re: UDF's in FoxPro indexes by Cindy

Cindy
Mon Jun 28 14:05:56 CDT 2004

In news: r2tod05j28gtd21m64gs4sfv09r67rat0l@4ax.com,
Josh Assing <xjoshx@jassing.com> wrote:

>> ... Descend() function allows mixed ascend/descend indexes...

> Why use a udf?
>
> Why not use the DESC keyword?

Hi Josh,

VFP won't accept mixed ascending and descending indexes.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy.winegarden@mvps.org www.cindywinegarden.com




Re: UDF's in FoxPro indexes by Josh

Josh
Tue Jun 29 08:40:44 CDT 2004


D'oh! Missed that mixed part.. thanks.

On Mon, 28 Jun 2004 15:05:56 -0400, "Cindy Winegarden"
<cindy.winegarden@mvps.org> wrote:

>In news: r2tod05j28gtd21m64gs4sfv09r67rat0l@4ax.com,
>Josh Assing <xjoshx@jassing.com> wrote:
>
>>> ... Descend() function allows mixed ascend/descend indexes...
>
>> Why use a udf?
>>
>> Why not use the DESC keyword?
>
>Hi Josh,
>
>VFP won't accept mixed ascending and descending indexes.


---
Remove x's to send.