EhLib.Com
https://forum.ehlib.com/en/

Issues in Lazarus
https://forum.ehlib.com/en/viewtopic.php?f=5&t=1055
Page 1 of 1

Author:  mladenp [ 11 Aug 2020, 12:21 ]
Post subject:  Issues in Lazarus

Hello, I am having some issues in Lazarus that I want to point out.

1. Whenever I enter edit mode on some field in TDbGridEh that for example has field size 8. And afterwards I try to edit another field that has a size of 20. The entire text would be cut to the size of 8. Like it remembers the size of the previous field and then applies it to the current field. This issue does not happen in Delphi 7, nor does it happen in standard Lazarus TDBGrid.

2. Until Lazarus version of 2.0.10 and free pascal version 3.2, Lazarus had an issue with TStringField holding Latin characters (šđčćž) that take 2 bytes per characters. So for example if we have a field that has a size of 20 and populate it with Latin characters that take 2 bytes , only half of them would be saved to database. They show ok while I am still in edit mode in TDbGridEh on some field. But as soon as data gets posted, it gets cut out. Lazarus own TDBGrid also had this issue until version 2.0.10, but this was fixed in free pascal 3.2.
To go around this issue I was forced to use this procedure:
Code:
procedure TForm1.SQLDataDriverEh1BuildDataStruct(DataDriver: TDataDriverEh;
                                                 DataStruct: TMTDataStructEh);
var
  sField: TMTStringDataFieldEh;
begin
  DataDriver.DefaultBuildDataStruct(DataStruct);
  sField := TMTStringDataFieldEh(DataStruct.ChangeFieldType('KLA_NAZ', TMTStringDataFieldEh));
  sField.StringDataType := fdtWideStringEh;
end;


3. When using CTRL+V to paste data into some field in TDBGridEh, Data gets pasted twice.

4.Custom filter in TDBgridEh, when using TDate = some value I get an error (Index based on unknown field "=")

Thank you!

Author:  EhLibSupport [ 18 Aug 2020, 02:40 ]
Post subject:  Re: Issues in Lazarus

Hello

I created simple App with fields size 8 and 20.
When I entered text into the DBGridEh column values, I didn't have any problem with the text being entered.
Attachment:
sshot-135.png
sshot-135.png [ 34.14 KiB | Viewed 2180 times ]


Quote:
2. Until Lazarus version of 2.0.10 and free pascal version 3.2, Lazarus had an issue with TStringField holding Latin characters (šđčćž) that take 2 bytes per characters.

It is not clear who and what should be corrected.
If the fixes have already been made to the FPC, then all LCL controls (including DBGridEh) should work automatically.

Quote:
3. When using CTRL+V to paste data into some field in TDBGridEh, Data gets pasted twice.

Yes. We will fix it at the next build.

Quote:
4.Custom filter in TDBgridEh, when using TDate = some value I get an error (Index based on unknown field "=")


Looks like FPC in method TBufDatasetParser.ParseExpression doesn't support filters for TDate fields.
We tested next expression: DataSet.Filter := 'DateField3=''18.08.2020''';
Do you know how to write filter expressions for TDate fields?
We don't know how.

Author:  mladenp [ 21 Aug 2020, 07:19 ]
Post subject:  Re: Issues in Lazarus

EhLibSupport wrote:
Hello
I created simple App with fields size 8 and 20.
When I entered text into the DBGridEh column values, I didn't have any problem with the text being entered.
Attachment:
The attachment sshot-135.png is no longer available

I haven't explained very well, sorry!
The problem is when I "enter" those fields. If I first enter the field that has the size of 8, the data gets selected properly. But if I afterwards "enter" a filed that has a size of 20 only 8 characters will be selected and the rest would not be shown. ( I have attached 2 screenshots that show this)




Quote:
Looks like FPC in method TBufDatasetParser.ParseExpression doesn't support filters for TDate fields.
We tested next expression: DataSet.Filter := 'DateField3=''18.08.2020''';
Do you know how to write filter expressions for TDate fields?
We don't know how.

This is the expression that should be used:
Filtering is similar - note: apparently you need to surround the string value you are comparing against with double quotes. See below for details on the DTOS function; basically you need to format the date as YYYYMMDD:
// we have a field named MODIFIED here:
MyDBF.Filter:='DTOS(MODIFIED) > "20051231"';

// if you want to compare datetime, that can be done:
// everything later than 2 January 2006, 4:34PM
MyDBF.Filter:='DTOS(MODIFIED) > "20060102 163400"';

MyDBF.Filtered:=true;

Best Regards!

Attachments:
File comment: After
Screenshot_2.png
Screenshot_2.png [ 95.06 KiB | Viewed 2163 times ]
File comment: Before
Screenshot_1.png
Screenshot_1.png [ 95.89 KiB | Viewed 2163 times ]

Author:  EhLibSupport [ 31 Aug 2020, 02:06 ]
Post subject:  Re: Issues in Lazarus

Hello

We fixed the error with the Size in the EhLib.VCL 9.5 Build 9.5.027.
Check, please.

Author:  mladenp [ 01 Sep 2020, 13:43 ]
Post subject:  Re: Issues in Lazarus

EhLibSupport wrote:
Hello

We fixed the error with the Size in the EhLib.VCL 9.5 Build 9.5.027.
Check, please.


Hello,

I have checked the error with Size, and confirm that it is now fixed.

Were the information about filtering by date that I provided you with helpful?

Author:  mladenp87 [ 01 Oct 2020, 09:44 ]
Post subject:  Re: Issues in Lazarus

EhLibSupport wrote:

Looks like FPC in method TBufDatasetParser.ParseExpression doesn't support filters for TDate fields.
We tested next expression: DataSet.Filter := 'DateField3=''18.08.2020''';
Do you know how to write filter expressions for TDate fields?
We don't know how.


Can you try using this filter expression?
DataSet.Filter := 'DTOS(DateField3) = ''20200818'''

Author:  mladenp87 [ 01 Oct 2020, 09:45 ]
Post subject:  Re: Issues in Lazarus

EhLibSupport wrote:
Looks like FPC in method TBufDatasetParser.ParseExpression doesn't support filters for TDate fields.
We tested next expression: DataSet.Filter := 'DateField3=''18.08.2020''';
Do you know how to write filter expressions for TDate fields?
We don't know how.


Can you try using this filter expression?
DataSet.Filter := 'DTOS(DateField3) = ''20200818'''

Author:  EhLibSupport [ 24 Oct 2020, 03:54 ]
Post subject:  Re: Issues in Lazarus

Hello

We fixed problem with Filter Date, DateTime fields in EhLib.VCL 10.0 Build 10.0.025
Please check.

Author:  mladenp [ 02 Nov 2020, 10:03 ]
Post subject:  Re: Issues in Lazarus

It works now. Thank you!

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/