Print Page | Close Window

Filters does not seem to work correctly

Printed From: TMS Software
Forum Name: myCloudData General
Forum Discription:
Printed Date: 28 Jan 2020 at 8:09pm

Topic: Filters does not seem to work correctly
Posted By: Davis Jarrod
Subject: Filters does not seem to work correctly
Date 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);
  if not FConnected then Exit;
  FTable.Filters.Add('Skill', aSkill, coEqual, loAnd);
  FTable.Filters.Add('Date', aStartDate, coGreaterOrEqual, loAnd);
  FTable.Filters.Add('Date', aEndDate, coLessOrEqual, loNone);
  FTable.Sorting.Add('Score', soDescending);
  FTable.PageSize := aCount;

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? 

Posted By: Davis Jarrod
Date Posted: 25 Oct 2018 at 1:58am
with loNone there, it says something about http 1.1/400 bad request exception. 

Posted By: Bart Holvoet
Date 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.

Posted By: Davis Jarrod
Date Posted: 25 Oct 2018 at 6:24pm
I'm  using the version from github:

Is there logging in this version? 

Posted By: Davis Jarrod
Date 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'...

Posted By: Davis Jarrod
Date 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. 

Posted By: Davis Jarrod
Date 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)
                Result.TotalResults := 0;

Posted By: Davis Jarrod
Date 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

Posted By: Davis Jarrod
Date 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??

Posted By: Bart Holvoet
Date Posted: 29 Oct 2018 at 2:11pm
This post was replied to via private email.

Print Page | Close Window