Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Filters does not seem to work correctly

 Post Reply Post Reply
Author
Davis Jarrod View Drop Down
New Member
New Member
Avatar

Joined: 14 Dec 2010
Posts: 9
Post Options Post Options   Quote Davis Jarrod Quote  Post ReplyReply Direct Link To This Post Topic: Filters does not seem to work correctly
    Posted: 25 Oct 2018 at 1:56am
I'm using the lib from github, trying to do this:

procedure TCloudScore.List(aSkill: Integer; aStartDate: string; aEndDate: string; aCount: Integer);
begin
  if not FConnected then Exit;
  FTable.Filters.Clear;
  FTable.Filters.Add('Skill', aSkill, coEqual, loAnd);
  FTable.Filters.Add('Date', aStartDate, coGreaterOrEqual, loAnd);
  FTable.Filters.Add('Date', aEndDate, coLessOrEqual, loNone);
  FTable.Sorting.Clear;
  FTable.Sorting.Add('Score', soDescending);
  FTable.PageSize := aCount;
  FTable.Query;
end;

This will just crash on the loNone line. I can change it to loAnd and it will then run, but the filtering does not seem to work correctly. I simply want to filter on skill, in between the date range and sort by the score. Any ideas about this? 

Back to Top
Davis Jarrod View Drop Down
New Member
New Member
Avatar

Joined: 14 Dec 2010
Posts: 9
Post Options Post Options   Quote Davis Jarrod Quote  Post ReplyReply Direct Link To This Post Posted: 25 Oct 2018 at 1:58am
with loNone there, it says something about http 1.1/400 bad request exception. 
Back to Top
Bart Holvoet View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2089
Post Options Post Options   Quote Bart Holvoet Quote  Post ReplyReply Direct Link To This Post Posted: 25 Oct 2018 at 3:33pm
I have not been able to reproduce this issue.
Can you please enable Logging and provide the LOG file so I can further investigate this?

Logging can be enabled by setting Logging to True and LogLevel to llDetail.
The LOG file is generated automatically in the machine's Documents folder.
Back to Top
Davis Jarrod View Drop Down
New Member
New Member
Avatar

Joined: 14 Dec 2010
Posts: 9
Post Options Post Options   Quote Davis Jarrod Quote  Post ReplyReply Direct Link To This Post Posted: 25 Oct 2018 at 6:24pm
I'm  using the version from github:
https://github.com/tmssoftware/TMS-myCloudData-RESTClient

Is there logging in this version? 
Back to Top
Davis Jarrod View Drop Down
New Member
New Member
Avatar

Joined: 14 Dec 2010
Posts: 9
Post Options Post Options   Quote Davis Jarrod Quote  Post ReplyReply Direct Link To This Post Posted: 25 Oct 2018 at 6:40pm
Ok, upon further tests, I see this exception error:

MyCloudData Exception: 070: Error retrieving records. Incorrect syntax near 'Date'...

Back to Top
Davis Jarrod View Drop Down
New Member
New Member
Avatar

Joined: 14 Dec 2010
Posts: 9
Post Options Post Options   Quote Davis Jarrod Quote  Post ReplyReply Direct Link To This Post Posted: 25 Oct 2018 at 7:03pm
Ok, looking at function TmyCloudDataEntityFilter.OperatorAsString(AOperator: TComparisonOperator): string;
The >= and <= conversion is backwards

In function TmyCloudDataEntityFilter.OperatorAsString(AOperator: TLogicalOperator): string;

when loNone is used, its set to a empty string, this seems to cause the bad http 1.1/400 error. 

Back to Top
Davis Jarrod View Drop Down
New Member
New Member
Avatar

Joined: 14 Dec 2010
Posts: 9
Post Options Post Options   Quote Davis Jarrod Quote  Post ReplyReply Direct Link To This Post Posted: 25 Oct 2018 at 7:06pm
In function TmyCloudDataTable.ExecuteQuery(AQuery: TmyCloudDataEntityQuery): TmyCloudDataEntityQueryResult;

This line:
Result.TotalResults := StrToInt(LCountStringValue)

Needs to be:
              if LCountStringValue <> '' then
                Result.TotalResults := StrToInt(LCountStringValue)
              else
                Result.TotalResults := 0;

Back to Top
Davis Jarrod View Drop Down
New Member
New Member
Avatar

Joined: 14 Dec 2010
Posts: 9
Post Options Post Options   Quote Davis Jarrod Quote  Post ReplyReply Direct Link To This Post Posted: 25 Oct 2018 at 7:13pm
loNone does not seem to be a supported opeator so I removed it from the set and from:
function TmyCloudDataEntityFilter.OperatorAsString(AOperator: TLogicalOperator): string;

so it only works with loAnd and loOr



Back to Top
Davis Jarrod View Drop Down
New Member
New Member
Avatar

Joined: 14 Dec 2010
Posts: 9
Post Options Post Options   Quote Davis Jarrod Quote  Post ReplyReply Direct Link To This Post Posted: 25 Oct 2018 at 7:18pm
In my test table I have:
  CS.Post('Player1', 1, 10, '2018/10/20', 'USA');
  CS.Post('Player2', 1, 20, '2018/10/21', 'Russia');
  CS.Post('Player3', 1, 30, '2018/10/22', 'China');
  CS.Post('Player4', 1, 40, '2018/10/23', 'France');
  CS.Post('Player5', 1, 50, '2018/10/24', 'England');

so a date from /20 to /24 and if I do:
CS.List(1, '2018/10/20)', '2018/10/21', 10);

it should return the 1st two records, but it does not. Only 21. I have to do:
CS.List(1, '2018/10/19)', '2018/10/21', 10); 

in order to return /20 and /21 which are in the logical range of >= 2018/10/20 and <= 2018/10/21. Not sure what is up with this. I can live with that I guess.

But it seems the github lib needs to be looked over and fixed. The last commit was 2 years ago it looks like??

Back to Top
Bart Holvoet View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2089
Post Options Post Options   Quote Bart Holvoet Quote  Post ReplyReply Direct Link To This Post Posted: 29 Oct 2018 at 2:11pm
This post was replied to via private email.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down