From: Andy on
Hello,

I am trying to filter all file in a folder having file name that starts with
2 character, for example CU.

I use Record File No. 2000000022 and following code:


SETRANGE(Path,'C:\TEMP\');
SETFILTER(Name,'=%1*','CU');
SETRANGE("Is a file",TRUE);
IF FINDSET THEN


FINDSET return always false also if in the folder there is a file called:
CU20091104183810.txt.

If I comment filter on Name FINDSET is true. Why this?
How can I apply right filter?

Thank you
From: Thomas Hütter on
Hi Andy,

try to filter like this: SETFILTER(Name, '%1', 'CU*');
and it should work.

Regards,
Thomas


Andy schrieb:
> Hello,
>
> I am trying to filter all file in a folder having file name that starts with
> 2 character, for example CU.
>
> I use Record File No. 2000000022 and following code:
>
>
> SETRANGE(Path,'C:\TEMP\');
> SETFILTER(Name,'=%1*','CU');
> SETRANGE("Is a file",TRUE);
> IF FINDSET THEN
>
>
> FINDSET return always false also if in the folder there is a file called:
> CU20091104183810.txt.
>
> If I comment filter on Name FINDSET is true. Why this?
> How can I apply right filter?
>
> Thank you
From: Spider on
Hi Andy,

It looks like the issue with the treating of the replacement fields (%1, %2,
and so on). If you use:
SETFILTER(Name,'=%1','CU*');
or
SETFILTER(Name,'%1','CU*');
or
SETFILTER(Name,'CU*');
it works as expected.

Hope it helps.




"Andy" wrote:

> Hello,
>
> I am trying to filter all file in a folder having file name that starts with
> 2 character, for example CU.
>
> I use Record File No. 2000000022 and following code:
>
>
> SETRANGE(Path,'C:\TEMP\');
> SETFILTER(Name,'=%1*','CU');
> SETRANGE("Is a file",TRUE);
> IF FINDSET THEN
>
>
> FINDSET return always false also if in the folder there is a file called:
> CU20091104183810.txt.
>
> If I comment filter on Name FINDSET is true. Why this?
> How can I apply right filter?
>
> Thank you