Re: [MSEide-MSEgui-talk] BufDataset

2021-05-18 Thread fredvs
Hello Med.

>  In the SRC  of msebufdataset.pas  there is a function to check that (
> checksumfield)  and abort the task.

Hum, in msebufdataset.pas I see a "procedure checksumfield" not a "function
checksumfield":

procedure tmsebufdataset.checksumfield(const afield: tfield;
 const fieldtypes: fieldtypesty);
begin
 checkbrowsemode;
 if (afield.fieldno <= 0) or (afield.dataset <> self) or
 not (ffieldinfos[afield.fieldno-1].base.fieldtype in 
 fieldtypes) then begin
  raise edatabaseerror.create('Invalid sum field
'+'"'+afield.fieldname+'".');
 end;
end;

> Is it possible to change this behavior without changing   source file?

Sorry but I will need more infos to understand.

- What is the goal, do you want the possibility to manage the behavior of
"checksumfield", to not only give (or not) a error message?
- Do you want that "checksumfield" becomes a function and the result is true
or false?
- What do you mean with " without changing  source file", are you talking
about the database file or about the source of the program?

Fre;D


  




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-18 Thread mohamed hamza
Hello Fred,

With this below piece of code I  do not want to test oField.datatype  and doing 
the sum to n where n  is VAR:currency

procedure tfrmbasePagefo.DoSum(oDbGrid: TDbwidgetgrid; iRow:integer);
VAR  n:currency; nn:integer; iCol:integer; oField:TField;

begin
with oDbGrid,oDbGrid.datalink.datasource do
for iCol:=0 to datacols.count-1 do
 with datacols[iCol]   do
 if  tag>0 then
 begin
  oField:=dataset.fields[tag-1];
  if (oField.datatype = ftinteger)  then
  begin
   tmsebufdataset(DataSet).sumfield(oField,nn);
   
fixrows[iRow].captions[iCol].caption:=format(tnumericField(oField).DisplayFormat,[nn]);
   end
   else
   begin
   tmsebufdataset(DataSet).sumfield(oField,n);
   
fixrows[iRow].captions[iCol].caption:=format(tnumericField(oField).DisplayFormat,[n]);
   end;  end; end;

Regards

Med

De : fredvs 
Envoyé : mardi 18 mai 2021 13:59
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Hello Med.

>  In the SRC  of msebufdataset.pas  there is a function to check that (
> checksumfield)  and abort the task.

Hum, in msebufdataset.pas I see a "procedure checksumfield" not a "function
checksumfield":

procedure tmsebufdataset.checksumfield(const afield: tfield;
 const fieldtypes: fieldtypesty);
begin
 checkbrowsemode;
 if (afield.fieldno <= 0) or (afield.dataset <> self) or
 not (ffieldinfos[afield.fieldno-1].base.fieldtype in
 fieldtypes) then begin
  raise edatabaseerror.create('Invalid sum field
'+'"'+afield.fieldname+'".');
 end;
end;

> Is it possible to change this behavior without changing   source file?

Sorry but I will need more infos to understand.

- What is the goal, do you want the possibility to manage the behavior of
"checksumfield", to not only give (or not) a error message?
- Do you want that "checksumfield" becomes a function and the result is true
or false?
- What do you mean with " without changing  source file", are you talking
about the database file or about the source of the program?

Fre;D







--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-18 Thread fredvs
Hello Med.

Here is tmsebufdataset.sumfield:

What about only comment the first line after begin ?
Is it what you want?
If so, maybe we can add a parameter (, nocheck) or create a new procedure
without check (procedure sumfield_nocheck).

procedure tmsebufdataset.sumfield(const afield: tfield; out asum: double);
var
 int1,int2: integer;
 index1: integer;
 po1: precheaderty;
 po2: pprecheaderty;
 bo1,bo2: boolean;
 state1: tdatasetstate;
begin
 checksumfield(afield,[ftfloat,ftcurrency]); // This enable/disable ?
 index1:= afield.fieldno - 1;
 asum:= 0;
 bo1:= filtered and assigned(onfilterrecord);
 state1:= settempstate(tdatasetstate(dscheckfilter));
 try
  int2:= ffieldinfos[index1].base.offset;
  po2:= pointer(findexes[0]);
  if bo1 then begin
   for int1:= 0 to fbrecordcount - 1 do begin
fcheckfilterbuffer:= pdsrecordty(pchar(ppointeraty(po2)^[int1])-
  
sizeof(dsheaderty));
bo2:= true;
onfilterrecord(self,bo2);
if bo2 and getfieldflag(@fcheckfilterbuffer^.header.fielddata.nullmask,
 index1) then
begin
 asum:= asum + pdouble(pchar(@fcheckfilterbuffer^.header)+int2)^;
end;
   end;
  end
  else begin
   for int1:= 0 to fbrecordcount - 1 do begin
po1:= ppointeraty(po2)^[int1];
if getfieldflag(@po1^.fielddata.nullmask,index1) then begin
 asum:= asum + pdouble(pchar(po1)+int2)^;
end;
   end;
  end;
 finally
  restorestate(state1);
 end; 
end;


Or I miss something, so explain please.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-18 Thread mohamed hamza
Hello Fred;

  I think we have to change the code msebufdataset.pas in this case  we have 
not to duplicate the source (sumfiled ) in our project.



procedure msebufdataset.sumfield(const afield: tfield; out asum: double; 
bCheck:boolean);


if bCheck then checksumfield(afield,[ftfloat,ftcurrency])


An other option is possible


We can set aFields.optionsfield of_user0 to (true or false )


What do  you think?



Med


De : fredvs 
Envoyé : mardi 18 mai 2021 14:48
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Hello Med.

Here is tmsebufdataset.sumfield:

What about only comment the first line after begin ?
Is it what you want?
If so, maybe we can add a parameter (, nocheck) or create a new procedure
without check (procedure sumfield_nocheck).

procedure tmsebufdataset.sumfield(const afield: tfield; out asum: double);
var
 int1,int2: integer;
 index1: integer;
 po1: precheaderty;
 po2: pprecheaderty;
 bo1,bo2: boolean;
 state1: tdatasetstate;
begin
 checksumfield(afield,[ftfloat,ftcurrency]); // This enable/disable ?
 index1:= afield.fieldno - 1;
 asum:= 0;
 bo1:= filtered and assigned(onfilterrecord);
 state1:= settempstate(tdatasetstate(dscheckfilter));
 try
  int2:= ffieldinfos[index1].base.offset;
  po2:= pointer(findexes[0]);
  if bo1 then begin
   for int1:= 0 to fbrecordcount - 1 do begin
fcheckfilterbuffer:= pdsrecordty(pchar(ppointeraty(po2)^[int1])-

sizeof(dsheaderty));
bo2:= true;
onfilterrecord(self,bo2);
if bo2 and getfieldflag(@fcheckfilterbuffer^.header.fielddata.nullmask,
 index1) then
begin
 asum:= asum + pdouble(pchar(@fcheckfilterbuffer^.header)+int2)^;
end;
   end;
  end
  else begin
   for int1:= 0 to fbrecordcount - 1 do begin
po1:= ppointeraty(po2)^[int1];
if getfieldflag(@po1^.fielddata.nullmask,index1) then begin
 asum:= asum + pdouble(pchar(po1)+int2)^;
end;
   end;
  end;
 finally
  restorestate(state1);
 end;
end;


Or I miss something, so explain please.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-18 Thread fredvs
Hello Med.

> What do  you think?

I would vote for this (set bCheck default to true for compatibility with
previous code):

procedure msebufdataset.sumfield(const afield: tfield; out asum: double;
bCheck: boolean = true);

And do it for all the other sumfield()  (integer, currency, float, etc).

Fre;D








--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-18 Thread fredvs
> An other option is possible 
> We can set aFields.optionsfield of_user0 to (true or false ) 

Nice too. (but more tricky).

Fre;D






--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-18 Thread mohamed hamza
Re Hello

Now summing  ftinteger  FIELD into  currency  VAR  gives 0 ?

Med

De : fredvs 
Envoyé : mardi 18 mai 2021 16:05
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

> An other option is possible
> We can set aFields.optionsfield of_user0 to (true or false )

Nice too. (but more tricky).

Fre;D






--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-18 Thread fredvs


> Now summing  ftinteger  FIELD into  currency  VAR  gives 0 ? 

Please, give code example, it is really difficult to understand otherwise.




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-18 Thread fredvs
Re-hello Med.

> Now summing  ftinteger  FIELD into  currency  VAR  gives 0 ? 

Sorry but I dont understand.

Why do you want to sum ftinteger field into a currency var?

Why not sum ftinteger field into a integer var and after this, convert the
integer var into a currency ?



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-18 Thread mohamed hamza
I want to change this peace of code

 procedure tfrmbasePagefo.DoSum(oDbGrid: TDbwidgetgrid; iRow:integer);
VAR  n:currency; nn:integer; iCol:integer; oField:TField;

begin
with oDbGrid,oDbGrid.datalink.datasource do
for iCol:=0 to datacols.count-1 do
 with datacols[iCol]   do
 if  tag>0 then
 begin
  oField:=dataset.fields[tag-1];
  if (oField.datatype = ftinteger)  then
  begin
   tmsebufdataset(DataSet).sumfield(oField,nn);
   
fixrows[iRow].captions[iCol].caption:=format(tnumericField(oField).DisplayFormat,[nn]);
   end
   else
   begin
   tmsebufdataset(DataSet).sumfield(oField,n);
   
fixrows[iRow].captions[iCol].caption:=format(tnumericField(oField).DisplayFormat,[n]);
   end;  end; end;

with this one

//  n = result even if ofield type is integer //

procedure tfrmbasePagefo.DoSum(oDbGrid: TDbwidgetgrid; iRow:integer);
VAR  n:currency;  iCol:integer; oField:TField;

begin
with oDbGrid,oDbGrid.datalink.datasource do
for iCol:=0 to datacols.count-1 do
 with datacols[iCol]   do
 if  tag>0 then
 begin
  oField:=dataset.fields[tag-1];
   tmsebufdataset(DataSet).sumfield(oField,n);
  
fixrows[iRow].captions[iCol].caption:=format(tnumericField(oField).DisplayFormat,[n]);
   end;   end;


Med


De : fredvs 
Envoyé : mardi 18 mai 2021 17:42
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Re-hello Med.

> Now summing  ftinteger  FIELD into  currency  VAR  gives 0 ?

Sorry but I dont understand.

Why do you want to sum ftinteger field into a currency var?

Why not sum ftinteger field into a integer var and after this, convert the
integer var into a currency ?



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-18 Thread fredvs
Ha, OK, indeed, nicer.

(But I like your first peace of code too.)

For the new code, maybe using a variant variable and create a new sumfield()
procedure:

procedure tmsebufdataset.sumfield(const afield: tfield; out asum: variant);

But for this, we need a variant-guru (I am beginner in variant type).

Do you have problems using your first peace of code (apart for the look) ?



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-19 Thread mohamed hamza
Hello Fred,

  Martin did not introduce variant_sumfield then for me it's not recommended.

Med



De : fredvs 
Envoyé : mardi 18 mai 2021 18:30
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Ha, OK, indeed, nicer.

(But I like your first peace of code too.)

For the new code, maybe using a variant variable and create a new sumfield()
procedure:

procedure tmsebufdataset.sumfield(const afield: tfield; out asum: variant);

But for this, we need a variant-guru (I am beginner in variant type).

Do you have problems using your first peace of code (apart for the look) ?



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-19 Thread fredvs
>   Martin did not introduce variant_sumfield then for me it's not
recommended.

I agree and also it seems that using variant will make all the process
slower.

In the last code you give, in the first peace of code:

procedure tfrmbasePagefo.DoSum(oDbGrid: TDbwidgetgrid; iRow:integer);
VAR  n:currency; nn:integer; iCol:integer; oField:TField;
begin
with oDbGrid,oDbGrid.datalink.datasource do
for iCol:=0 to datacols.count-1 do
 with datacols[iCol]   do
 if  tag>0 then  
 begin
  oField:=dataset.fields[tag-1];
  if (oField.datatype = ftinteger)  then
  begin
   tmsebufdataset(DataSet).sumfield(oField,nn);
  
fixrows[iRow].captions[iCol].caption:=format(tnumericField(oField).DisplayFormat,[nn]);
   end
   else
   begin
   tmsebufdataset(DataSet).sumfield(oField,n);
  
fixrows[iRow].captions[iCol].caption:=format(tnumericField(oField).DisplayFormat,[n]);
   end;  end; end;

For me that code is OK, what problems do you have using it?

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-19 Thread mohamed hamza
Hello Fred,

The blocks  B1 and B2  after  if   are  redondant that  all .This procedure 
works well.


 if (oField.datatype = ftinteger)  then
  begin
  B1 else B2

Med

De : fredvs 
Envoyé : mercredi 19 mai 2021 12:15
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

>   Martin did not introduce variant_sumfield then for me it's not
recommended.

I agree and also it seems that using variant will make all the process
slower.

In the last code you give, in the first peace of code:

procedure tfrmbasePagefo.DoSum(oDbGrid: TDbwidgetgrid; iRow:integer);
VAR  n:currency; nn:integer; iCol:integer; oField:TField;
begin
with oDbGrid,oDbGrid.datalink.datasource do
for iCol:=0 to datacols.count-1 do
 with datacols[iCol]   do
 if  tag>0 then
 begin
  oField:=dataset.fields[tag-1];
  if (oField.datatype = ftinteger)  then
  begin
   tmsebufdataset(DataSet).sumfield(oField,nn);

fixrows[iRow].captions[iCol].caption:=format(tnumericField(oField).DisplayFormat,[nn]);
   end
   else
   begin
   tmsebufdataset(DataSet).sumfield(oField,n);

fixrows[iRow].captions[iCol].caption:=format(tnumericField(oField).DisplayFormat,[n]);
   end;  end; end;

For me that code is OK, what problems do you have using it?

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-19 Thread fredvs
Hello Med.

Maybe you can complete the code checking all types that can be summed:

if (oField.datatype = ftinteger)  then  B1 
else if (oField.datatype = ftcurrency)  then B2
else if (oField.datatype = ftfloat)  then B3
else if (oField.datatype = ftbcd)  then B4
else if (oField.datatype = ftdate)  then B5
else if (oField.datatype = fttime)  then B6
else if (oField.datatype = ftdatetime)  then B7
else error('That field cannot be summed');

(My 0.01 cent of course).

Fre;D







--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-19 Thread fredvs
Re-hello Med.

sumfield is only implemented for double, currency, integer and int64:
   
   procedure sumfield(const afield: tfield; out asum: double); overload;
   procedure sumfield(const afield: tfield; out asum: currency); overload;
   procedure sumfield(const afield: tfield; out asum: integer); overload;
   procedure sumfield(const afield: tfield; out asum: int64); overload;

So, to sum date/time it seems that a new method is needed.
But you know much better mse-database than me, so forget my previous
proposition to sum date/time.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-20 Thread Sieghard
On Tue, 18 May 2021 18:13:10 +
mohamed hamza  wrote:

> I want to change this peace of code
> 
>  procedure tfrmbasePagefo.DoSum(oDbGrid: TDbwidgetgrid; iRow:integer);
> VAR  n:currency; nn:integer; iCol:integer; oField:TField;
...
> with this one
...
> procedure tfrmbasePagefo.DoSum(oDbGrid: TDbwidgetgrid; iRow:integer);
> VAR  n:currency;  iCol:integer; oField:TField;

Your problem might be caused by the principal imcompatibility of a 64
bit with a 32 bit data type (currency vs. integer). You might attempt
to use an explicit cast ("integer (n)") to coerce the currency value
into an integer, accepting possible loss of range, precision or both.
Basically, the first version of the code seems to attempt (!) to resolve
the incompatibility of the data types by using an (implicitely assumed)
_real_ type result field for the "currency" case. Even that might fail
if the result data type doesn't comply.

-- 
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
---
Mit freundlichen Grüßen, S. Schicktanz
---



___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-20 Thread Sieghard
On Tue, 18 May 2021 11:30:32 -0700 (MST)
fredvs  wrote:

> (But I like your first peace of code too.)

Well, let that second piece rest in peace, rather...

> For the new code, maybe using a variant variable and create a new
> sumfield() procedure:

Yes, that might be a more general solution. It's maybe a bit clumsy
because of the neccessary _explicit_ coercion conversions, but it will
probabely work in all cases, or can be made to do so.

> procedure tmsebufdataset.sumfield(const afield: tfield; out asum:
> variant);
> 
> But for this, we need a variant-guru (I am beginner in variant type).

Well, I'm definitively _not_ one - I even depise variants and avoid
them where possible. Variants are really not a data type, at least not
a _simple_ one. They are rather complex records containing a variant
part for the real data, preceded by a description of what it entails.
And this description has to be provided by the issuer, when a variant
is built. Although this can be done implicitely by the compiler at
times, i.e. if it can predetermine what the variant is meant to contain.

-- 
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
---
Mit freundlichen Grüßen, S. Schicktanz
---



___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-20 Thread mohamed hamza
Hi Sieghard,

   Your answer  deserves to be applied but my  firebird data fields to be sumed 
are either  integer  (16,32,64 bits)  or numeric (x,y).  Numeric (x,y)  is 
compatible with  currency Var.

Regards

Med



De : Sieghard 
Envoyé : jeudi 20 mai 2021 10:30
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

On Tue, 18 May 2021 11:30:32 -0700 (MST)
fredvs  wrote:

> (But I like your first peace of code too.)

Well, let that second piece rest in peace, rather...

> For the new code, maybe using a variant variable and create a new
> sumfield() procedure:

Yes, that might be a more general solution. It's maybe a bit clumsy
because of the neccessary _explicit_ coercion conversions, but it will
probabely work in all cases, or can be made to do so.

> procedure tmsebufdataset.sumfield(const afield: tfield; out asum:
> variant);
>
> But for this, we need a variant-guru (I am beginner in variant type).

Well, I'm definitively _not_ one - I even depise variants and avoid
them where possible. Variants are really not a data type, at least not
a _simple_ one. They are rather complex records containing a variant
part for the real data, preceded by a description of what it entails.
And this description has to be provided by the issuer, when a variant
is built. Although this can be done implicitely by the compiler at
times, i.e. if it can predetermine what the variant is meant to contain.

--
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
---
Mit freundlichen Grüßen, S. Schicktanz
---



___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-20 Thread fredvs
Hi Med.

> Numeric (x,y)

Hum, indeed, I just check and there is that "numeric" type for DB (that I
did not know).
I have to deeply study those DB features.

(And it is why some demos from you will be more than welcome).

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-20 Thread mohamed hamza
Hello Fred,

We can make procedure better if we  have access to the kind of widget 
contained into grid.col

 we can do
  if  .col[i]  is tdbintegeredit then b1 else b2

  currently tag is an index to the field and can cause an error .

Med

De : fredvs 
Envoyé : jeudi 20 mai 2021 13:55
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Hi Med.

> Numeric (x,y)

Hum, indeed, I just check and there is that "numeric" type for DB (that I
did not know).
I have to deeply study those DB features.

(And it is why some demos from you will be more than welcome).

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-20 Thread Sieghard
Hello mohamed,

you wrote on Thu, 20 May 2021 13:07:57 +:

>Your answer  deserves to be applied but my  firebird data fields
> to be sumed are either  integer  (16,32,64 bits)  or numeric (x,y).
> Numeric (x,y)  is compatible with  currency Var.

Right, Numeric is compatible with currency, and (probabely) also with
integer. But currency and integer are _not_ (directly) compatible,
because one is a "whole number" type (integer), and the other is a
_scaled_ number (currency, of course), which is lumped into the "real"
types by fpc. In fact, currency is a 64 bit integer shifted "down" by
(AFAIK) 4 decimal places, i.e. the integer value 1 is equivalent
to a currency value of "1", which incidentally would be equivalent to
approximately a db numeric (20, 4) (20 digits w/ 4 decimal places).
What this means is that to add an integer to such a "numeric" value,
the integer value would have to be multiplied by 1 first, whereas
a currency value could be added directly. Things change "a bit" for
numerics of other kinds, a (n, 3) numeric value, e.g., would require
a scaling factor of 1000 against an integer, but a factor of 0.1 (!)
aginst a currency value. These scaling operations are what makes the
data types incompatible and what requires special handling for
operations with the "numeric" db data type.
I hope I got that all (mostly) right and could state it understandably.

(BTW, all this has to be taken into account by a "variant" data type
value, of course, what is what makes variants very complicated to
handle and requires a lot of code to be implicitely added by the
compiler and linker.)

-- 
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
---
Mit freundlichen Grüßen, S. Schicktanz
---



___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-20 Thread fredvs
Hello Med.

> if  .col[i]  is tdbintegeredit then b1 else b2

In a form1.mfm, the kind of widget is declared as this:

object atwidgetgrid: twidgetgrid 
   ...
datacols.count = 1
datacols.items = <  
item[something]
  width = 20
  widgetname = 'mycol'
  dataclass = tgridintegerdatalist
 end  
...

So I did try to access the "dataclass" property with this:

  if atwidgetgrid.datacols.items[0].dataclass = tgridintegerdatalist then  ;

Sadly this does not work (Error: (5038) identifier idents no member
"dataclass" ).

Maybe somebody knows the synthax how to access that "dataclass" property.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-20 Thread fredvs
Re-hello Med.

With this it compiles but I did not test for database:

 if twidgetcols(atwidgetgrid.datacols[i]).getitemclasstype =
tgridintegerdatalist then ;

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-21 Thread mohamed hamza
Hello Fred,

  Thank you for trying to help but I think it's not possible to know which  
db*edit widget is into col [i].

see piece of my mfm file. there is not an tgridintegerdatalist

 item[tdbintegeredit1]
frame.localprops = []
frame.localprops1 = []
tag = 3
width = 100
options = [co_fill, co_savevalue, co_savestate, co_mousescrollrow]
name = 'col2'
widgetname = 'tdbintegeredit1'
  end

Med.


De : fredvs 
Envoyé : jeudi 20 mai 2021 22:54
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Re-hello Med.

With this it compiles but I did not test for database:

 if twidgetcols(atwidgetgrid.datacols[i]).getitemclasstype =
tgridintegerdatalist then ;

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-21 Thread fredvs
Hello Med.

Would it not be possible to give a short complete demo of your code?

For me it is very difficult to understand-help only with short piece of
code.

With concrete example maybe other people and me could understand-help for
what you are looking for.

>  see piece of my mfm file. there is not an tgridintegerdatalist

Of course, I did use a twidgetgrid and a tgridintegerdatalist into the first
column of the twidgetgrid.

What kind of widget are you using for the grid?

Did you look at the code of the grid and the datacols property?

What happens is you use "grid.datacols[i]).getitemclasstype" ?

Could you give the code of your mfm file, mostly all concerning the grid you
use?

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-21 Thread fredvs
Re hello Med.

Ok, I am near my crystal ball.

Not sure to see well but it seems that you use a tdbstringgrid for grid.

If it is the case, could you try this:

- Add "msewidgetgrid," in the uses section of your "main.pas" file (if not
already there, of course).

- Use this to know what kind of column you have:

if twidgetcols(tdbstringgrid1.datacols[0]).getitemclasstype = tdbintegeredit
then ; 






--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-21 Thread mohamed hamza
Hello Fred,

   Your Crystal ball is very strong. It saw right 😊 .

But the result is not what expected.  There is a segmentation fault  
lib/common/widgets/msewidgets.pas

4206 FUNCTION TCOL_SETOPTIONS1

I continue  with this DoSum()   procedure

Regards

Med



De : fredvs 
Envoyé : vendredi 21 mai 2021 14:17
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Re hello Med.

Ok, I am near my crystal ball.

Not sure to see well but it seems that you use a tdbstringgrid for grid.

If it is the case, could you try this:

- Add "msewidgetgrid," in the uses section of your "main.pas" file (if not
already there, of course).

- Use this to know what kind of column you have:

if twidgetcols(tdbstringgrid1.datacols[0]).getitemclasstype = tdbintegeredit
then ;






--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-22 Thread fredvs
Hello Med.

>  Your Crystal ball is very strong. It saw right 😊 .

Yes, when I clean it a few, there are beautiful things to see sometimes.

By the way, a side is still dirty and I cannot wash it at the moment.

For example:

> There is a segmentation fault  lib/common/widgets/msewidgets.pas
>b4206 FUNCTION TCOL_SETOPTIONS1

I cannot read the code that raise that segmentation fault.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-22 Thread mohamed hamza
Hello Fred,

  In fact I want to achieve a new tdbobject which has tdbwidgetgrid as ancestor.

  This new object: TDBBrowse contains a method  : sumCol ( nRow:integer, 
nCol:intger);   in this case I have to find which tdb*edit is concerned.

   After reflection,  I' m planning to add tdb*edit as parameter  then the 
procedure becomes sumCol ( const sender:TOBject; nRow:integer, nCol:intger).

  What do you think about these  procedures ? DoSum()sumCol ( nRow:integer, 
nCol:intger)   sumCol ( const sender:TOBject; nRow:integer, nCol:intger

where is the right one ?

Regards
Med


De : fredvs 
Envoyé : samedi 22 mai 2021 11:03
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Hello Med.

>  Your Crystal ball is very strong. It saw right 😊 .

Yes, when I clean it a few, there are beautiful things to see sometimes.

By the way, a side is still dirty and I cannot wash it at the moment.

For example:

> There is a segmentation fault  lib/common/widgets/msewidgets.pas
>b4206 FUNCTION TCOL_SETOPTIONS1

I cannot read the code that raise that segmentation fault.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-22 Thread fredvs
Hello Med.

It seems to me ok to add a parameter for your new object/method.

And I will be very happy to test this wonder in your MSE-DB demo.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-23 Thread mohamed hamza
Hi Sieghard

   Many thanks  for your help. But this does not explain why we can not sum 
integer field into a currency VAR with Martin's sumField Procedure?

Med

De : Sieghard 
Envoyé : jeudi 20 mai 2021 19:24
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Hello mohamed,

you wrote on Thu, 20 May 2021 13:07:57 +:

>Your answer  deserves to be applied but my  firebird data fields
> to be sumed are either  integer  (16,32,64 bits)  or numeric (x,y).
> Numeric (x,y)  is compatible with  currency Var.

Right, Numeric is compatible with currency, and (probabely) also with
integer. But currency and integer are _not_ (directly) compatible,
because one is a "whole number" type (integer), and the other is a
_scaled_ number (currency, of course), which is lumped into the "real"
types by fpc. In fact, currency is a 64 bit integer shifted "down" by
(AFAIK) 4 decimal places, i.e. the integer value 1 is equivalent
to a currency value of "1", which incidentally would be equivalent to
approximately a db numeric (20, 4) (20 digits w/ 4 decimal places).
What this means is that to add an integer to such a "numeric" value,
the integer value would have to be multiplied by 1 first, whereas
a currency value could be added directly. Things change "a bit" for
numerics of other kinds, a (n, 3) numeric value, e.g., would require
a scaling factor of 1000 against an integer, but a factor of 0.1 (!)
aginst a currency value. These scaling operations are what makes the
data types incompatible and what requires special handling for
operations with the "numeric" db data type.
I hope I got that all (mostly) right and could state it understandably.

(BTW, all this has to be taken into account by a "variant" data type
value, of course, what is what makes variants very complicated to
handle and requires a lot of code to be implicitely added by the
compiler and linker.)

--
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
---
Mit freundlichen Grüßen, S. Schicktanz
---



___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-23 Thread fredvs
Hello Med.

> we can not sum integer field into a currency VAR with Martin's sumField
> Procedure?

Does it happen only with last msegui 5.4.0 or was it the case with previous
version 4.6.0 too?

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-23 Thread mohamed hamza
Hello Fred,

  Same  error with  All ver  .

By the way I did

VAR  s:currency;

s:=0;
while  not ( query.eof ) begin
s:=s+query.fieldbyname( < INTEGERFIELD>).value;
quey.next; end;

I had not an error.

Med



De : fredvs 
Envoyé : dimanche 23 mai 2021 13:42
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Hello Med.

> we can not sum integer field into a currency VAR with Martin's sumField
> Procedure?

Does it happen only with last msegui 5.4.0 or was it the case with previous
version 4.6.0 too?

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-23 Thread fredvs
Hello Med.

OK (but for me only part of code you give is like you are talking in
Martian).

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-23 Thread fredvs
Re-hello med.

> s:=s+query.fieldbyname( < INTEGERFIELD>).value;

Ha, maybe I get it.

If I understand ok, with your code it works, but with Martin's code using
sumfield() it does not work.

If so, do you think it would be possible to create a new sumfield() that
uses your code and that will work?

Fre;D





--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-23 Thread mohamed hamza
Re-Hello Fred,

   I  do not think so. I have to understand why Martin did like that. There is 
probably a raison?

Med.



De : fredvs 
Envoyé : dimanche 23 mai 2021 14:46
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Re-hello med.

> s:=s+query.fieldbyname( < INTEGERFIELD>).value;

Ha, maybe I get it.

If I understand ok, with your code it works, but with Martin's code using
sumfield() it does not work.

If so, do you think it would be possible to create a new sumfield() that
uses your code and that will work?

Fre;D





--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-23 Thread fredvs
Hello Med.

> There is probably a raison?

It seems that Martin wanted that the field-type is the same as out-sum
variable.
It is the reason why he added the "checksumfield" method at init of each
"sumfield" method.

But why, I dont know (because your code shows that it is possible to add
integer fields into currency).
On the other side, like Sieghard said, imho summing integers into a currency
variable is a little strange.

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-23 Thread Sieghard
Hello mohamed hamza,

Du schriebst am Sun, 23 May 2021 09:02:31 +:

>Many thanks  for your help. But this does not explain why we can
> not sum integer field into a currency VAR with Martin's sumField
> Procedure?

Maybe it does, as his if statement seems to be directed toward the
distinction between integer and real (floating point) data types.
True integer values are handled differently from floats, and this may
be done because of the way the compiler handles parameter passing in
these cases. It might (in facr, it _has to_) implicitely coerce
(convert) an integer into a floating point value, while a real
floating point value could probably be passed directly. One would
have to inspect the innards of the code handling the different cases,
or even the compiler output. I didn't research this deeply, though.

The compiler's feature to discern functions by their parameter list -
overloded functions and procedures - allows many neat things, but
there are limitations to this, and your case seems to be a good
example for such a limitation:.So you might simply use that feature,
declaring TWO different overloaded sum functions, where one of them
takes an integer and the other one a currency value as the pertinent
parameter. You might just as well get fancy and declare other variants
for any other data type you want. You just _have to make sure_ that
the compiler can _always_ recognize the true type of all of the
function's parameters.

-- 
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
---
Mit freundlichen Grüßen, S. Schicktanz
---



___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-23 Thread fredvs
Re-re-re hello Med.
Hello Sieghard.

After deeper look into procedure tmsebufdataset.sumfield(const afield:
tfield; out asum: currency);

Here my conclusion:

There are only:

case ffieldinfos[afield.fieldno-1].base.fieldtype of
   
 ftbcd:
ftfloat:

And I dont see really why tfinteger: is banned.

Maybe we can add tfinteger: in case and adapt the code for it.
And change checksumfield in first line with
checksumfield(afield,[ftinteger,ftbcd,ftfloat]);

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-23 Thread fredvs
Hi Med + Sieghard.

I would propose this:

procedure tmsebufdataset.sumfield(const afield: tfield; out asum: currency);
var
 int1,int2: integer;
 index1: integer;
 po1: precheaderty;
 po2: pprecheaderty;
 bo1,bo2: boolean;
 state1: tdatasetstate;
begin
 checksumfield(afield,[ftinteger,ftbcd,ftfloat]); // this changed
 index1:= afield.fieldno - 1;
 asum:= 0;
 bo1:= filtered and assigned(onfilterrecord);
 state1:= settempstate(tdatasetstate(dscheckfilter));
 try
  int2:= ffieldinfos[index1].base.offset;
  po2:= pointer(findexes[0]);
  case ffieldinfos[afield.fieldno-1].base.fieldtype of
   ftinteger: begin  // this added
if bo1 then begin
 for int1:= 0 to fbrecordcount - 1 do begin
  fcheckfilterbuffer:= pdsrecordty(pchar(ppointeraty(po2)[int1])-
 
sizeof(dsheaderty));
  bo2:= true;
  onfilterrecord(self,bo2);
  if bo2 and getfieldflag(
  @fcheckfilterbuffer^.header.fielddata.nullmask,index1) then
begin
   asum:= asum + pinteger(pchar(@fcheckfilterbuffer^.header)+int2)^;
  end;
 end;
end
else begin
 for int1:= 0 to fbrecordcount - 1 do begin
  po1:= ppointeraty(po2)^[int1];
  if getfieldflag(@po1^.fielddata.nullmask,index1) then begin
   asum:= asum + pinteger(pchar(po1)+int2)^;
  end;
 end;
end;
   end;
   ftbcd: begin
if bo1 then begin
 for int1:= 0 to fbrecordcount - 1 do begin
  fcheckfilterbuffer:= pdsrecordty(pchar(ppointeraty(po2)[int1])-
 
sizeof(dsheaderty));
  bo2:= true;
  onfilterrecord(self,bo2);
  if bo2 and getfieldflag(
  @fcheckfilterbuffer^.header.fielddata.nullmask,index1) then
begin
   asum:= asum + pcurrency(pchar(@fcheckfilterbuffer^.header)+int2)^;
  end;
 end;
end
else begin
 for int1:= 0 to fbrecordcount - 1 do begin
  po1:= ppointeraty(po2)^[int1];
  if getfieldflag(@po1^.fielddata.nullmask,index1) then begin
   asum:= asum + pcurrency(pchar(po1)+int2)^;
  end;
 end;
end;
   end;
   ftfloat: begin
if bo1 then begin
 for int1:= 0 to fbrecordcount - 1 do begin
  fcheckfilterbuffer:= pdsrecordty(
  
pchar(ppointeraty(po2)^[int1])-sizeof(dsheaderty));
  bo2:= true;
  onfilterrecord(self,bo2);
  if bo2 and getfieldflag(
@fcheckfilterbuffer^.header.fielddata.nullmask,index1) then
begin
   asum:= asum + pdouble(pchar(@fcheckfilterbuffer^.header)+int2)^;
  end;
 end;
end
else begin
 for int1:= 0 to fbrecordcount - 1 do begin
  po1:= ppointeraty(po2)^[int1];
  if getfieldflag(@po1^.fielddata.nullmask,index1) then begin
   asum:= asum + pdouble(pchar(po1)+int2)^;
  end;
 end;
end;
   end;
  end;
 finally
  restorestate(state1);
 end; 
end;


But if you allow to sum integers into currency variable, there is no reason
why not to do it too to sum integer into double variable.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-23 Thread fredvs
Hello Med.

The last for tonight.

Could you try changing your /mseide-msegui/lib/common/db/msebufdataset.pas
with the one in attachment?

msebufdataset.zip
  

This one enable (I hope) to add integer-fields into currency variable.
I did some test to add integers into a currency/float variable and did not
note problems.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-24 Thread mohamed hamza
Hello Fred,

 You did a lot .  Now DoSum becomes:

procedure tfrmbasePagefo.DoSum(oDbGrid: TDbwidgetgrid; iRow:integer);
var iCol:integer; oField:TField; n:currency;
begin

with oDbGrid,oDbGrid.datalink.datasource do
 for iCol:=0 to datacols.count-1 do
 with datacols[iCol] do
 if  tag>0 then
 begin
 oField:=dataset.fields[tag-1];
 tmsebufdataset(DataSet).sumfield(oField,n);
 with tBCDField(oField),fixrows[iRow].captions[iCol] do
 begin
  if currency then 
caption:=currtostrf(n,ffcurrency,precision,defaultFormatSettings)
   else caption:=currtostrf(n,ffnumber,  
precision,DefaultFormatSettings);
  case ord(alignment)  of
  0:caption:=PADRIGHT (caption, displaywidth);
  1:caption:=PADLEFT  (caption, displaywidth);
  2:caption:=PADCENTER(caption, displaywidth);
  end;
 end; end; end;

But  how do you call this  patch an upgrade to 5.4.1 or just a hidden because 
not all programmers want  to sum  integer into currency?
By the way the new FPC compiles well MSEIDE-MSEGUI.

Med

De : fredvs 
Envoyé : dimanche 23 mai 2021 21:15
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Hello Med.

The last for tonight.

Could you try changing your /mseide-msegui/lib/common/db/msebufdataset.pas
with the one in attachment?

msebufdataset.zip
<http://mseide-msegui-talk.13964.n8.nabble.com/file/t2/msebufdataset.zip>

This one enable (I hope) to add integer-fields into currency variable.
I did some test to add integers into a currency/float variable and did not
note problems.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-24 Thread fredvs
Hello Med.

>  because not all programmers want  to sum  integer into currency?

Dis you try the msebufdataset.zip of my previuos post?
 

No problem if a programmer want to sum integer into integer, he may still
use:
 procedure sumfield(const afield: tfield; out asum: integer);

> this  patch an upgrade to 5.4.1 

I just wait for your green light, when you have done all the hard tests
without problems, I will propose the patch for commit into 5.4.1.

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-24 Thread fredvs
Hello Med.

To resume, I propose this for the patch:

   procedure sumfield(const afield: tfield; out asum: currency); 
  "afield" type could be: [ftinteger,ftsmallint,ftword,ftbcd,ftfloat] //
should we add ftlargeint?

  procedure sumfield(const afield: tfield; out asum: double); 
  "afield" type could be: [ftinteger,ftsmallint,ftword,ftfloat,ftcurrency])
//  // should we add ftlargeint?
 
  procedure sumfield(const afield: tfield; out asum: integer); 
   "afield" type could be: [ftinteger,ftsmallint,ftword,) // should we add
round([ftfloat,ftcurrency])?

   procedure sumfield(const afield: tfield; out asum: int64);  
   "afield" type could be: [ftlargeint,ftinteger,ftsmallint,ftword] //
should we add round([ftfloat,ftcurrency])?

Here the patched /mseide-msegui/lib/common/db/msebufdataset.pas:
msebufdataset.zip
  

Fre;D







--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-24 Thread mohamed hamza
Hello Fred,

I'd like to go back to the last discussions if you allow it.

It"s about :


segmentation fault  lib/common/widgets/msewidgets.pas  Line 4206 OF FUNCTION 
TCOL_SETOPTIONS1


the line code which raise this error is  in procedure dosum


if tdbwidgetcols(odbgrid.datacols[iCol]).getitemclasstype = tdbintegerEdit then 



It's the same error with if 
twidgetcols(odbgrid.datacols[iCol]).getitemclasstype = tdbintegerEdit then 




Regard.


Med.



De : fredvs 
Envoyé : lundi 24 mai 2021 13:47
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Hello Med.

To resume, I propose this for the patch:

   procedure sumfield(const afield: tfield; out asum: currency);
  "afield" type could be: [ftinteger,ftsmallint,ftword,ftbcd,ftfloat] //
should we add ftlargeint?

  procedure sumfield(const afield: tfield; out asum: double);
  "afield" type could be: [ftinteger,ftsmallint,ftword,ftfloat,ftcurrency])
//  // should we add ftlargeint?

  procedure sumfield(const afield: tfield; out asum: integer);
   "afield" type could be: [ftinteger,ftsmallint,ftword,) // should we add
round([ftfloat,ftcurrency])?

   procedure sumfield(const afield: tfield; out asum: int64);
   "afield" type could be: [ftlargeint,ftinteger,ftsmallint,ftword] //
should we add round([ftfloat,ftcurrency])?

Here the patched /mseide-msegui/lib/common/db/msebufdataset.pas:
msebufdataset.zip
<http://mseide-msegui-talk.13964.n8.nabble.com/file/t2/msebufdataset.zip>

Fre;D







--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-24 Thread fredvs
Hello Med.

> the line code which raise this error:
> if tdbwidgetcols(odbgrid.datacols[iCol]).getitemclasstype = tdbintegerEdit
> then ...

Here I dont get error (but I dont have all your code and I dont find my
ball)

Hum, I dont understand fully the mse-synthax but could you try with this:
(see the ".cols" added after "datacols"):

tdbwidgetcols(odbgrid.datacols.cols[iCol]).getitemclasstype = tdbintegerEdit
then 

This compile and run without error too here.

Note that I never used that "getitemclasstype" property and also I dont know
if it is what we need to get the type of the column.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-24 Thread fredvs
Re_hello Med.

You may try this (from previous post):

if tdbwidgetcols(odbgrid.datacols.cols[iCol]).getitemclasstype =
tdbintegerEdit then 

There is also this one:

if tdbwidgetcols(odbgrid.datacols.items[iCol]).getitemclasstype =
tdbintegeredit then ...

But I really would prefer that you show more code to understand better what
you want.

Fre;D





--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-24 Thread fredvs
Re... hello Med.

Maybe you may try a other way.

It seems to me that the kind of column in a BDStringgrid is assigned when
you connect the fields to the tmsesqlquery1-field.

So if you want to know the kind of column in a BDStringgrid, this should
work:

var
str : string;
datatype: tfieldtype;
...

str := odbgrid.datacols.cols[iCol]].datafield; // to get the name of the
field.
 
for x:= 0 to tmsesqlquery1.FieldDefs.count -1 do // look in query the same
name
begin
if str = tmsesqlquery1.FieldDefs[x].name then
datatype := tmsesqlquery1.FieldDefs[x].DataType; // Yep, you get the
datatype
end;

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-25 Thread fredvs
Hello Med.

**Many** thanks for the demo, much easy to understand now.

Indeed, here there is a error with:
 
if tdbwidgetcols(odbgrid.datacols.items[iCol]).getitemclasstype =
tdbintegerEdit
 then showMessage( 'DONE ');

I get that error (and I dont understand why):

"testf" 0x00658f11 in SETOPTIONS1 (this=0x994d50, AVALUE=...) at
../../mseide-msegui/lib/common/editwidgets/msewidgetgrid.pas:1944

I will continue to try to find a solution but I am a little lost now.
I am nearly sure that there is a way to know what kind of class is used in
the tdbwidgetcols.

Maybe tonight I will have better idea.

Fre;D






--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-25 Thread fredvs
Yep Med.

Using this is ok here:

 if tdbwidgetcol(odbgrid.datacols.items[iCol]).datalink.field.datatype =
ftInteger
  then showMessage('It is a ftInteger');

(But maybe it is not what you want)

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-25 Thread mohamed hamza
Hello Fred,

but why
showmessage(tdbwidgetcol(odbgrid.datacols.items[iCol]).datalink.field.name);

gives an empty message?

Med


De : fredvs 
Envoyé : mardi 25 mai 2021 15:05
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Yep Med.

Using this is ok here:

 if tdbwidgetcol(odbgrid.datacols.items[iCol]).datalink.field.datatype =
ftInteger
  then showMessage('It is a ftInteger');

(But maybe it is not what you want)

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-25 Thread fredvs
Hi Med.

In attachment, your project with type of column enabled:

test__med.zip
  

 

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-25 Thread Fred van Stappen
[cid:00b09dfb-c88c-45bb-bdb4-2fae771c56e4]


Here, with this (see fieldname in one word) it works (see picture):

showmessage(tdbwidgetcol(odbgrid.datacols.items[iCol]).datalink.fieldname)

Fre;D

De : mohamed hamza 
Envoyé : mardi 25 mai 2021 17:50
À : General list for MSEide+MSEgui 
Objet : Re: [MSEide-MSEgui-talk] BufDataset

Hello Fred,

but why
showmessage(tdbwidgetcol(odbgrid.datacols.items[iCol]).datalink.field.name);

gives an empty message?

Med


De : fredvs 
Envoyé : mardi 25 mai 2021 15:05
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Yep Med.

Using this is ok here:

 if tdbwidgetcol(odbgrid.datacols.items[iCol]).datalink.field.datatype =
ftInteger
  then showMessage('It is a ftInteger');

(But maybe it is not what you want)

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-25 Thread fredvs
Re re re hello Med!

In attachment your project with name and type of column:


test__med.zip
  


 

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-28 Thread mohamed hamza
Hello Fred,

   Just a moment to test sum float into currency .

   2 steps :

1 with sumfield
2 with SQL statementSELECT SUM (  )  from ...

Med.

De : mohamed hamza 
Envoyé : mardi 25 mai 2021 15:50
À : General list for MSEide+MSEgui 
Objet : Re: [MSEide-MSEgui-talk] BufDataset

Hello Fred,

but why
showmessage(tdbwidgetcol(odbgrid.datacols.items[iCol]).datalink.field.name);

gives an empty message?

Med


De : fredvs 
Envoyé : mardi 25 mai 2021 15:05
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Yep Med.

Using this is ok here:

 if tdbwidgetcol(odbgrid.datacols.items[iCol]).datalink.field.datatype =
ftInteger
  then showMessage('It is a ftInteger');

(But maybe it is not what you want)

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-28 Thread mohamed hamza
RE HELLO,

Here is the result.  Is it safe to apply the patch ( buffdataset and 
VERSION.TXT ) ?

Is there an other patch to buffdataset?  I think Sumfield()  increase the code 
size because overloaded 4 times or more

Med

De : mohamed hamza 
Envoyé : vendredi 28 mai 2021 09:13
À : General list for MSEide+MSEgui 
Objet : Re: [MSEide-MSEgui-talk] BufDataset

Hello Fred,

   Just a moment to test sum float into currency .

   2 steps :

1 with sumfield
2 with SQL statementSELECT SUM (  )  from ...

Med.

De : mohamed hamza 
Envoyé : mardi 25 mai 2021 15:50
À : General list for MSEide+MSEgui 
Objet : Re: [MSEide-MSEgui-talk] BufDataset

Hello Fred,

but why
showmessage(tdbwidgetcol(odbgrid.datacols.items[iCol]).datalink.field.name);

gives an empty message?

Med


De : fredvs 
Envoyé : mardi 25 mai 2021 15:05
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataset

Yep Med.

Using this is ok here:

 if tdbwidgetcol(odbgrid.datacols.items[iCol]).datalink.field.datatype =
ftInteger
  then showMessage('It is a ftInteger');

(But maybe it is not what you want)

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-05-28 Thread fredvs
Hello Med.

>  Is it safe to apply the patch ( buffdataset and VERSION.TXT ) ?

If you used the last buffdataset.pas that I provided for me all seems ok
too.

(Here is the file concerned:)
msebufdataset.zip
  

The new version will be then 5.4.2.  

> Is there an other patch to buffdataset?

All the change are in sumfield() methods and are in the file in assert,
nothing else was changed.

> I think Sumfield()  increase the code size because overloaded 4 times or
> more 

Hum, not sure to understand, could you give more infos?
What is overloaded?

Do you have something to give to compare?

Fre;D







--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataset

2021-06-07 Thread fredvs
Hello Med.

>   I think it's safe to apply the patch. 

OK, done with commit ee9b368b4

>  In the case of sum the same code is repeated 4 times , I believe.  I want
> to optimize that if it's possible?

Of course, please do it ( and do a pull-request when you are ready).

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

2019-09-25 Thread mohamed hamza
When I  confirm the deletion of a grid.row this one disappears. I expect status 
usDeleted, but the status of the dataset returned usUnmodified.

procedure tfrmBasePagefo.upDateRowData(const sender: tcustomgrid;
   const arow: Integer; const adataset: 
TDataSet);
begin
  case adataset.updatestatus of
usInserted:sender.rowcolorstate[arow]:= 0;
usModified:sender.rowcolorstate[arow]:= 1;
usDeleted: sender.rowcolorstate[arow]:= 2;  <-- no break here when 
I delete record ?
else
  sender.rowcolorstate[arow]:= 255;
  end;
end;





De : mohamed hamza 
Envoyé : mardi 24 septembre 2019 21:05
À : General list for MSEide+MSEgui 
Objet : [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

Hi All,

Does anyone know how to keep showing deleted records  in a dbgrid?

Regards.

Med
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

2019-09-26 Thread fredvs
Hello Med.

> usDeleted: sender.rowcolorstate[arow]:= 2;  <-- no break here
> when I delete record ?

What fpc version are you using?
Do you have problems with fpc 3.0.2 / 3.0.4 too ?

After a quick investigation, "usDeleted" is defined in
/mseide-msegui/lib/common/fpccompatibility/mdb.pas

So, if it appends with fpc > 3.0.4, this must be related with the new
fpc-inventions.

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

2019-09-26 Thread fredvs
Re-hello Med.

Like explained earlier, I did not jump into mse-db yet.

But if you add, in attachment,  a simple example of what you want to show,
it would be much easier for me to investigate.

Fe;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

2019-09-26 Thread mohamed hamza
Hello Fred,

  There is some code concerned in msebufdataset also.

 Try to test my prj

 Ex:
  Insert  applyUpdate then
  editapplyUpdate
  delete to see the result.

  You can also use cancelupdate,  the project is  attached.

Thank you for trying to help

Med.

NB:There are some comments in main source.

De : fredvs 
Envoyé : jeudi 26 septembre 2019 12:15
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

Re-hello Med.

Like explained earlier, I did not jump into mse-db yet.

But if you add, in attachment,  a simple example of what you want to show,
it would be much easier for me to investigate.

Fe;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk



mseskin.rar
Description: mseskin.rar
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

2019-09-26 Thread fredvs
Hello Med.

>  Try to test my prj

OK, I did it.

Hum, indeed, with your wishes, there should be a option in the navigator to
only "mark as deleted" a row in the db-grid.
(and not delete the row completely).

But because Martin did add "updatestatus =  usDeleted", sure there must be a
trick to no delete the row in the grid but only mark it as "on the way to
delete".

And only if "tlocaldataset1.ApplyUpdates" is called, then the row may be
deleted.

Re-hum, I am totally new in mse-db, I will jump deeper into it asap.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

2019-09-26 Thread fredvs
Re-hello Med.

It seems that it is a common problem with lot of databases:

https://forum.lazarus.freepascal.org/index.php?topic=25153.0

https://stackoverflow.com/questions/7671205/statusfilter-on-clientdataset


Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

2019-09-27 Thread mohamed hamza
Hello,

   I think to:
   Add a calculated field  to the dataset ( bdel)
   Abort the deletion in  afterdelete event of dataset
   Set bDel  field to true.

   But how to set status to uDeleted ?

What do you think ?

Med.



Envoyé : jeudi 26 septembre 2019 22:43
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

Re-hello Med.

It seems that it is a common problem with lot of databases:

https://forum.lazarus.freepascal.org/index.php?topic=25153.0

https://stackoverflow.com/questions/7671205/statusfilter-on-clientdataset


Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

2019-09-27 Thread mohamed hamza
Error : abort  delet  in beforeDelete event

De : mohamed hamza 
Envoyé : vendredi 27 septembre 2019 13:18
À : General list for MSEide+MSEgui 
Objet : Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

Hello,

   I think to:
   Add a calculated field  to the dataset ( bdel)
   Abort the deletion in  afterdelete event of dataset
   Set bDel  field to true.

   But how to set status to uDeleted ?

What do you think ?

Med.



Envoyé : jeudi 26 septembre 2019 22:43
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

Re-hello Med.

It seems that it is a common problem with lot of databases:

https://forum.lazarus.freepascal.org/index.php?topic=25153.0

https://stackoverflow.com/questions/7671205/statusfilter-on-clientdataset


Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

2019-09-27 Thread fredvs
Hello Med. 

> Add a calculated field  to the dataset ( bdel)
 >  Abort the deletion in  afterdelete event of dataset  
 >   Set bDel  field to true.

Huh, it is exactly what I was thinking.
If you have access the dataset and may add a new column/boolean:  "Mark as
deleted", this will be the best.
And before dataset.ApplyUpdates" is called, first delete all the rows that
have "Mark as deleted" = true.

But if you are not allowed to add a new column in dataset, I do not see how
to do.

>   But how to set status to uDeleted ?

IMHO, adataset.updatestatus (usInserted,  usModified or usDeleted) is
read-only.
You may not change it manually.
(But maybe I am wrong, I did not check it).

> Error : abort  delet  in beforeDelete event  

Sorry, I dont understand, please explain better.

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

2019-09-27 Thread fredvs
Re-hello Med.

>> Error : abort  delet  in beforeDelete event   
> Sorry, I dont understand, please explain better. 

Ha, ok, I think I understood.
With the trick to add a "Mark as deleted" field, you should NOT use the
"Del" button of the mse-db-navigator.

You should create a custom "Del" button that only will set ""Mark as
deleted" to true for the row selected.

And use adataset.delete for all the rows with Mark as deleted" = true, just
before calling dataset.ApplyUpdates.

Fre;D





--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

2019-09-28 Thread mohamed hamza
We can find many tricks to solve the problem.  Looking for an universal way and 
integrate it   in msegui lib is better if we want to give a more to martin's 
project.

Martin's project is not only MseLang but also this great RAD is'nt it ?

Med.

De : fredvs 
Envoyé : vendredi 27 septembre 2019 20:02
À : mseide-msegui-talk@lists.sourceforge.net 

Objet : Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

Re-hello Med.

>> Error : abort  delet  in beforeDelete event
> Sorry, I dont understand, please explain better.

Ha, ok, I think I understood.
With the trick to add a "Mark as deleted" field, you should NOT use the
"Del" button of the mse-db-navigator.

You should create a custom "Del" button that only will set ""Mark as
deleted" to true for the row selected.

And use adataset.delete for all the rows with Mark as deleted" = true, just
before calling dataset.ApplyUpdates.

Fre;D





--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

2019-09-30 Thread fredvs
Hello Med.

Of course you are more than welcome to contribute to make mse better.

And dont hesitate to have your own Github account!

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


___
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk