-
Content Count
310 -
Joined
-
Last visited
-
Days Won
1
Posts posted by Serge_G
-
-
I don't think soundex to be a good algorithm, I certainly look for phonetic
-
Hi,
22 hours ago, XylemFlow said:Could I create a class deriving from TSpinBox and then override some of the functionality perhaps?
No, this new TSpinBox should use the same style.
22 hours ago, XylemFlow said:The other annoying thing with styles is that I have to create the style for each platform, including each Windows version.
Except if you put this style in the default collection. As I remember when style is to be applied, "delphi" look for platform style and then default style if stylelookup is not found.
22 hours ago, XylemFlow said:I think that the reason the exception didn't happen in Windows XP compatibility mode is because there was no style for it.
Ah, this should be a possibility
Another solution is to change the style of the component during runtime
(I found this trick some month ago, but I don't remember where I save this one)[EDIT]
Finally, found. If you read French it's in my blog I explain 2 methods, I think second one "modify the style directly" could apply.
If you can screenshot what you expect I will take this like a challenge 😉 -
On 10/19/2022 at 10:50 AM, tobenschain said:BudSys_DB.RecNo := recnum;
Really ! I don't think this use of recnum is serious. Why don't you use something like
if FDConnection.ExecSQL('DELETE FROM mytable where Key=:K',[sysp^.key ])>0 then showmessage('record(s) deleted');
Even if I am not sure of this sysp^.key have the good value 😲 expect yes, but this should be tested by debug
- 1
-
-
14 hours ago, Linuxuser1234 said:python doesn't work on delphi fmx
You can use Python4Delphi
-
35 minutes ago, Pat Foley said:Serge_G listbox coding is very nice example. Serge's "Introduction to FireMonkey XE4 Styles" is good start about differences between FMX and VCL and in text! His A.F.R.O may help you with the disappearing.
Thanks, but this AFRO thing is now obsolete because IDE force it when you close designer (ouf)
-
16 hours ago, Kurt G said:But the compiler give error: Undeclared identifier: TListviewItem in the line: Lvi : TListViewItem;
You declare a TListbox not a TListView so it's normal, units for Tlistview ( FMX.TlistView,FMX.TlistView.xxxx) are not declared
works with a TlistView
A list box (simple one without style) should be filled with Listbox1.Items.Add('Hello')
other way is to declare a TListboxItem
var aItem : TlistboxItem; begin aItem:=TlistboxItem.Create(Self); aItem.Parent:=ListBox1; aItem.Text:='Hello'; end;
P.S. If you want to involve style, here is a tutorial I wrote (long time ago, XE4, when TListview does not exists) Intro to styles Firemonkey XE4 (sorry in French)
-
-
Hi,
Generally, I use this syntaxtbAddUser.Insert; tbAddUser.FieldByName('JM_User').asString := userstring; tbAddUser.FieldByName('OldValue').asString := DBEdit23.Text; tbAddUser.Post;
-
There are no Firebird command for this. But you are in a Delphi forum, so my response should be :"Use FDBatchmove "
-
19 hours ago, lt.col.blair said:The forms have that stylebook assigned in their StyleBook property.
Set UseStyleManager to true of StyleBook to avoid this. Note : Only one TStyleBook can be set.
19 hours ago, lt.col.blair said:I don't understand the difference between "StyleLookup" and "StyleName".
for exemple : put a Tpath and a panel on a form, fill the tpath with some data and set stylename to i.e. 'mytpath'
now set panel.stylelookup to 'mytpath' and you will have your response19 hours ago, lt.col.blair said:But when I double click the StyleBook, that is placed on the DataSet to edit its styles, it is completely empty!
Ok, but did you pay attention to platform ? Have a look at platform 'default' and others if any in stylebook.styles collection
20 hours ago, lt.col.blair said:I could not find any Style settings in the .fmx
Ho ! You surely miss it because it's in "binary format"
object StyleBook1: TStyleBook Styles = < item ResourcesBin = { 464D585F5354594C4520322E350106125370656564427574746F6E315374796C 653103EA13005450463007544C61796F757400095374796C654E616D65061253... } end item Platform = 'Windows 10 Desktop' ResourcesBin = { 464D585F5354594C4520322E3501060D427574746F6E315374796C6531039B0F 005450463007544C61796F757400095374796C654E616D65060D427574746F6E
-
Agree with @Stano. Read the manuals https://firebirdsql.org/file/documentation/html/en/refdocs/fblangref30/firebird-30-language-reference.html#fblangref30-dml-delete
Have a look at global syntax of Delete it does not support jointures (noted as [<joins>] in a SELECT clause).You have to use a subquery
DELETE FROM ORDETAIL OD WHERE OD.REMAINQTY = 0 AND Not Exists (SELECT 1 FOM ORDERS WHERE ID = OD.ID and INVDOCNO IS NOT NULL )
-
Hi, only a single result but you can change to
function GetBomCosts(const ItemCode : String; var value1, value2 : Double) : boolean begin with TFDQuery.Create do begin Value1:=0; value2:=0; Connection:= FDConnection1; SQL.Text:='SELECT itemcode,value1,value2 from table where code='+quotedstr(itemcode); active:=true; if fieldbyname('Itemcode').isNull then result:=false else begin value1:=FieldByName('value1').asFloat; value2:=FieldByName('value2').asFloat; result:=true; end; active:=false; end; end;
- 2
-
16 hours ago, Henry Olive said:ACCAccount table is like below
ACCCODE, DEBIT, CREDIT
Why do I ask for table description because I was thinking about a ACCOUNT,YEAR key or worst
Why did you use 2 "embedded" SELECT when only one is needed ?So I suggest you to write and test this for first one
ALTER PROCEDURE UPDATEACC_SINGLE ( ACCCODE VARCHAR(20), ACTIVEYEAR VARCHAR(4) ) AS DECLARE VARIABLE ACCREDIT NUMERIC(15,2); DECLARE VARIABLE ACDEBIT NUMERIC(15,2); BEGIN IF (ACCCODE IS NULL) THEN EXIT; SELECT SUM(AD.DEBIT),SUM(AD.CREDIT) FROM ACCRECDETAIL AD JOIN ACCRECEIPT AR ON AD.RNO=AR.RNO WHERE AD.ACCCODE=:ACCCODE and EXTRACT(YEAR FROM AR.TDATE)=:ACTIVEYEAR) INTO :ACDEBIT,:ACCREDIT; UPDATE ACCACCOUNT SET DEBIT=:ACDEBIT,CREDIT=:ACCREDIT WHERE ACCCODE=:ACCCODE END
And second one
/* For all records update s.proc */
ALTER PROCEDURE UPDATEACC_ALL ( ACTIVEYEAR VARCHAR(4) ) AS DECLARE VARIABLE ACCOUNT VARCHAR(20); DECLARE VARIABLE ACCREDIT NUMERIC (15,2); DECLARE VARIABLE ACDEBIT NUMERIC (15,2); begin FOR SELECT ACCCODE, SUM(AD.DEBIT),SUM(AD.CREDIT) FROM ACCRECDETAIL AD JOIN ACCRECEIPT AR ON AR.RNO=AD.RNO WHERE EXTRACT(YEAR FROM AR.TDATE)=:ACTIVEYEAR GROUP BY ACCCODE INTO :ACCOUNT,:ACDEBIT,:ACCREDIT DO UPDATE ACCACCOUNT SET DEBIT=:DEBIT, CREDIT=:AMOUNT WHERE ACCCODE=:ACCOUNT; end
Note : you have to adjust VARIABLE declaration to your need of course
-
Hi, for me the 2 updates lack of a WHERE clause, but it depend on ACCACCOUNT table description
-
I should say it's a problem of dataset(s). For me, your fastreport design is not good. In my mind you have to rework your datasets but this mean you have to give us more information than 2 screenshots
ie. involved tables structureBy the way :
1 - you have a french forum for this https://www.developpez.net/forums/f1771/logiciels/solutions-d-entreprise/business-intelligence/autres-outils-decisionnels/fastreport/
2- your question need a cystalball !
- 1
-
6 hours ago, Henry Olive said:I asked this question a couple of months ago here Mr.Serge
replied me (Thank you again) and said it is normal.
Are you sure I wrote "normal" ? Oh! I see my "yes" was not for size (abnormal for me ) but for the "if there are users connected ("warmbackup ")"
sorry for mistyping, when I quoted the second part about size, something happened and I was thinking No it's abnormal
-
@Fr0sT.Brutal, code was edited during your post.
Just a thing, this MyCode = 600.005.0010 then requested result = 600.005.0011 should not work you have to manage a way to have the good formatstring
something like
procedure TForm23.Button1Click(Sender: TObject); var S : TArray<String>; fmt : string; begin S:=Edit3.Text.Split(['.']); fmt:='%.'+Length(S[Length(S)-1]).tostring+'d'; S[length(S)-1]:=Format(fmt,[(StrToInt(S[Length(S)-1])+1)]); Edit3.Text:=String.Join('.',S); end;
- 1
-
Hi, yes you can Split
procedure TForm23.Button1Click(Sender: TObject); var S : TArray<String>; begin S:=Edit3.Text.Split(['.']); S[length(S)-1]:=Format('%.3d',[(StrToInt(S[Length(S)-1])+1)]); Edit3.Text:=String.Join('.',S); end;
-
-
37 minutes ago, Stano said:I checked the translation where "and I don't create an runtime TFDQuery"
not my mother tongue too
37 minutes ago, Stano said:a communication error somewhere
Yes, here I miss some words I think
I am not a fan of the WITH but, sometimes using it by lazyness
-
Something like :
const SQL = // asSQltext with TFDQuery.Create(self) do begin connection:=fdconnection; SQL.Text:=SQL; //parambyName //macrobyname Open; // processing Close; end;
or
const SQL = 'your sql'; var Q : TFDQuery; Q:=TFDQuery.Create(self); try Q.Connection:=FDConnection; Q.SQL.Text:=SQL; //Q.ParamByName //Q.macrobyName Q.Open; // processing Q.Close; finally Q.Free; end;
-
Stano Ok, my response is in three parts.
1- The first is only a Firebird compliant SQL on how to use DATEADD function, and for the question asked, just sufficient.
2- Why I am not fan of the subquery ? Because it is evaluated at each row of MYTABLE .Perhaps a CTE should be better, but with the so poor data sample I am lazy to test over
WITH X AS (SELECT MAX(DATEADD(-10 DAYS FROM TDATE)) MD FROM MYTABLE) SELECT M.ID,M.TNAME,M.TDATE,M.INVNO FROM MYTABLE M JOIN X ON 1=1 WHERE M.TNAME='AA' AND (TDATE>=X.MD OR M.INVNO IS NULL)
Note that I prefer the list of each column to an *
3- Delphi side, yes there is code (much more lines and I don't create an runtime TFDQuery .... ) but queries with parameters is, I think is a very usefull technique (I use for years)
-
Hi,
- what is this X.INVRNO ? Your test table only contains INVNO column !
- use DateAdd Firebird function to compute your old date parameter
DATEADD(-10 DAYS FROM SELECT MAX(TDATE) FROM MYTABLE ))
or
SELECT MAX(DATEADD(-10 DAYS FROM TDATE)) FROM MYTABLE
I am not fan of sub-querys I should certainly prefer a Delphi Code based (we are in a Delphi forum 😉) and a Firedac query with parameters and macro (for the in clause)
var d : variant; begin YourFDquery.Close; d:=FDConnection.ExecSQLScalar('SELECT MAX(DATEADD(:g DAYS FROM TDATE)) FROM MYTABLE',[-10]) // in this way you can change day number if not VarisEmpty(d) then begin YourFDQuery.SQl.text('SELECT * FROM MYTABLE WHERE (TDATE >= :d or INVNO IS NULL) &inmacro'); YourFDQuery.ParamByName('d').asDateTime:=d; yourFDquery.MacroByName('inmacro').asRaw:='AND TNAME IN (''AA'')'; // so you can easily change, i.e *using format or clear clause yourFDQuery.Open; end;
Ok, I change position of the IN clause to easily clear the clause but, you can modify SQL text to
YourFDQuery.SQl.text('SELECT * FROM MYTABLE WHERE &inmacro (TDATE>=:D OR INVNO IS NULL)'); YourFDQuery.ParamByName('d').asDateTime:=d; yourFDquery.MacroByName('inmacro').asRaw:='TNAME IN (''AA'') AND';
* "inmacro" can be computed by a format,
var mymacro : String; begin mymacro:=Format('TNAME IN (%s) AND',[list_of_quoted_tname]);
Listview Programming
in FMX
Posted · Edited by Serge_G
Hi,
2 solutions.
First one is to use a TListView and Dynamic appearance, like this (listview "livebinded" to fdmemtable)
In this case, it could be easy to manage groups.
pro : if data is in a Table, it's easy to fill with livebindings and easy to manage groups
con : if you want different size (possible) you have to code
Second one is to use a TScollbox and a TFrame (same design as Item).
pro : It's easy to resize a TFrame. In this case, Headergroup should certainly be another frame.
con : All is to code
Depending of solution you choose, I will explain more if needed