Paradox Community

Items in pnews.paradox-programming

Subject:Re: Tcursor SetRange() and SetGenFilter()
Date:Tue, 22 Sep 2020 19:42:13 -0800
From:Peter <>
Okay, I finally solved this

tbl structure
EmpID   (S) (key)
Dat     (D) (key)
EntryID (N) (key)
other fields
last field -
Cull    (L)

tbf on form
Date field called "Wdate", format shows mmm.dd e.g. "Sep.17"

tcursor range is set
"tc.setRange(empID,Wdate)" note "Wdate" is the field in the tbf

on my custom method
dynFilt["Cull"] = logCull (a logical var)

inspecting variable
view(Wdate) shows a properly formatted date e.g. "9/17/2020"
view(ary) shows "86,Sep.17,Sep.17"

tc.setGenFilter(dynFilt) errors because bad date format ("Sep.17")

I fixed this by sourcing the date a different way
dmGet("ARCHRS","Dat",DatHrs) (DatHrs var = Date)

now it works

So the problem was that when the tcursor setRange was getting the date 
from the tbf it also carried the format of the field and not just the 
(raw) underlying data stored in the tbl

Strange though that the "view(Wdate)" shows a properly formatted date

case solved, Sherlock out

Thanks for your ideas Kevin.

On 9/16/2020 9:29 PM, Kevin Zawicki wrote:
> You can use a range and filter, at least I just tested on a tcursor open
> to a table.
> Based on what you said:
>> "Date Separator missing"
> I think this is a specific message, applying a non valid date to date.
> is dynFilt empty prior to this?
> dynFilt.view()
> Is CULL a logical field - add logical cast
>> dynFilt["Cull"] = logical(TRUE )
> Is CULL on the form / table frame?
> If not add it (you can make it run visible false).
> Test the filter alone.
> Can you set the filter before the range?
> Without the range?
> Peter <> wrote:
>> Upon opening a form I open a tcursor and do a setrange. In a custom
>> method I need to work only on the records that are 'live', in the table
>> I have a logical field with values False/True.
>> The setrange looks like this:
>> tcuCur.setRange(EmpID, Wdate, Wdate) ;//empid and wdate are fields on
>> the form
>> In a custom method I set a filter:
>> dynFilt["Cull"] = TRUE         ;//dynfilt is dynamic array
>> tcuCur.setGenFilter(dynFilt)
>> When I run the method it chokes on the setGenFilter, it complains that
>> it cannot "set order/range" and the next part says "Date Separator missing".
>> What I am getting from this is that when setting the filter it is
>> including the fields EmpID and Wdate. I thought that a tcursor could do
>> a filter on only an existing range of records.
>> Can anyone shed some light on this? Thanks.
>> Peter

Copyright © 2004