-
Content Count
315 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Serge_G
-
As I (but the replay). I use Rest for quite a while, but I was not aware of that suffix property 😮. I still have some difficulty with the usage of this thing (better that parameters I think ?) I am not so far in your book (the priority chapters for me were Livebindings and FMX Styles)
-
And when did Firedac will support Firebird for Android? Actually, Unidac can (it's just a little hard to deploy Firebird correctly)! I am not an Interbase fan, especially when I found that Interbase don't have windowing functions Oh, I also asked a question about Firebird with same behaviour : ignored. Don't know if I made a mistake with webinar or there was an Embarcadero filter
-
Please, when you post a question like this, don't forget to give us table description and in which context (Delphi+Component, GUI etc.! An advice : Get the Firebird 4.0 migration guide https://www.firebirdnews.org/migration-guide-to-firebird-4/ or read short version here I think that one problem is how you have migrated your Interbase BDD to Firebird and I persist, in my mind, version 3 would have been a better target As Vandrovnick said typecasting should a solution but try also a ROUND function (especially if QTY is not an integer) SELECT ID, ROUND(UPRICE * QTY,2) PRICE -- To test FROM TABLE1 Note : did you test without parenthesis? SELECT ID,UPRICE*QTY PRICE FROM TABLE1
-
firebird .conf says # ---------------------------- # External Function (UDF) Paths/Directories # # UdfAccess may be None, Full or Restrict. If you choose # Restrict, provide ';'-separated trees list, where UDF libraries # are stored. Relative paths are treated relative to the root directory # of firebird. # # Since FB4.0 default value is None. Set it to 'Restrict UDF' to have # the same restrictions as in previous FB versions. To specify access # to specific trees, enum all required paths (for Windows this may be # something like 'C:\ExternalFunctions', for unix - '/db/udf;/mnt/udf'). # # NOTE: THE EXTERNAL FUNCTION ENGINE FEATURE COULD BE USED TO COMPROMISE # THE SERVER/HOST AS WELL AS DATABASE SECURITY!! # # IT IS STRONGLY RECOMMENDED THAT THIS SETTING REMAINS NONE! # # Type: string (special format) # #UdfAccess = None First change is to uncomment (removing #) last line and say UdfAccess = Restrict UDF as wrote line 10 (pointing the dir_udf directory C:\Program Files\Firebird\Firebird_4 _0\UDF) or indicate directories like indicated below line 10 UdfAcess=C:\interbase\UDF;C:\MyUDF .... If you make a non customed install of Firebird 4.0 you should see the UDF directory don't exist, and no udflib dll copied AS I said if you want a near Interbase Firebird use version 3
-
By the way, don't forget to indicate the GUI (or other) you use for the SQL. With FlameRobin (I guessed) you need these SET TERM, but with IBExpert it wouldn't have been necessary.
-
Hi, First, know that : there are many internal functions in Firebird SUBSTR should be replaced advantageously by SUBSTRING (even if a little more "verbose" syntax) Udf are deprecated in Firebird 4.0 (P.S. don't ask me about UDR, I am still with 2.5 in production, 3 running only for test, 4 only installed) read 5.10 chapter of Firebird 4.0 Language reference In my mind, Firebird 3 is closer Interbase For the declaration of the UDF, I think you have to first check firebird .conf file (default parameter “UdfAccess” set to “None” ) , UDFs directories and bitness of the library also involved
-
Use SET TERM SET TERM $ ; CREATE PROCEDURE CUSTITEMMOVEMENT ( CUSTNO INTEGER ) RETURNS ( RNO INTEGER, TNAME VARCHAR(5), TDATE DATE, DOCNO VARCHAR(12), QTY NUMERIC(18, 2), NETPRICE NUMERIC(18, 4), ITEMNO VARCHAR(20), ITEMNAME VARCHAR(40) ) AS BEGIN FOR SELECT IM.RNO,IM.TNAME,IM.TDATE,IM.DOCNO,IM.QTY, IM.NETPRICE,IM.ITEMNO, IT.ITEMNAME FROM ITEMMOVEMENTS IM JOIN ITEMS IT ON IT.ITEMNO=IM.ITEMNO WHERE (IM.CUSTNO= :CUSTNO) ORDER BY IM.TDATE, IM.DOCNO INTO :RNO,:TNAME,:TDATE,:DOCNO,:QTY,:NETPRICE,:ITEMNO,:ITEMNAME DO SUSPEND; END $ SET TERM ; $ By the way, don't use quotation marks except if you want columns names to be case-sensitive and, for purpose of maintenance I suggest you not to name your columns xxxNO if type is not a number
-
Delete a ListView Item together with its livebinding DB record.
Serge_G replied to Tang's topic in FMX
Yes, but if I do so, it's because the AIndex argument of OnDelete event is always 0 ! (what a strange thing no ?) -
Delete a ListView Item together with its livebinding DB record.
Serge_G replied to Tang's topic in FMX
Hi, No, the image I post was a "classic" ImageListItemRightButton Item appearance (with TextButton visible) , and ImageListItemRightButtonDelete for the ItemEdit appearance. The "access error", I got it when I try to use a ListView1.DeleteItem(AItem.Index); beforehand declared as an helper (only way I found to raise OnDelete/Ondeleting event with touch input unavailable. TListViewHelper = class helper for TListView public function DeleteItem(const ItemIndex: Integer): Boolean; end; { TListViewHelper } function TListViewHelper.DeleteItem(const ItemIndex: Integer): Boolean; begin inherited; end; And using the OnButtonClick event of TListView (guilt, the TListItem.MouseUp event) Using the OnItemClick to use DeleteItem procedure TForm1.ListView1ItemClick(const Sender: TObject; const AItem: TListViewItem); begin ListView1.DeleteItem(AItem.Index); end; I have no "access error" Sorry, it was an "argument out of range" not an "access violation" (guilty TListItemView.GetObject). My test (on Android), shows me that if there is only one item (the one to delete) this exception does not raise. Yes, perhaps a bypass but in wich event ? -
Delete a ListView Item together with its livebinding DB record.
Serge_G replied to Tang's topic in FMX
So, I test this on Android. @Tang I can submit you this solution Add a private variable (in my code key : integer;) procedure TForm1.ListView1DeleteItem(Sender: TObject; AIndex: Integer); begin if FDMemtable1.Locate('id',key) then fdmemtable1.Delete; // delete the record end; procedure TForm1.ListView1DeletingItem(Sender: TObject; AIndex: Integer; var ACanDelete: Boolean); begin key:=listView1.Items[aIndex].Tag; // get the key to delete ACandelete:=true; end; But, yes, there is one, I think there is a bug I wrote in the prior post : -
Delete a ListView Item together with its livebinding DB record.
Serge_G replied to Tang's topic in FMX
Ok, but I try this on a windows pc how can I "simulate" this wipeleft ? On another hand, with a "classic" windows app (D11 Alexandria). I found that Deleting last item of the list raise an 'access violation' ! procedure TForm1.LinkListControlToField1FilledListItem(Sender: TObject; const AEditor: IBindListEditorItem); begin (AEditor.CurrentObject as TListItem).Tag := FDTable1.FieldByName('ID').AsInteger; end; procedure TForm1.ListView1ButtonClick(const Sender: TObject; const AItem: TListItem; const AObject: TListItemSimpleControl); begin if FDtable1.Locate('Id',AItem.Tag) then FDtable1.Delete; end; -
Delete a ListView Item together with its livebinding DB record.
Serge_G replied to Tang's topic in FMX
Hi, Well, I don't understand the goal, I never use this DeletingItem method, but I will investigate. So to be clear : You have a TListView filled with livebindings, how do you : A gesture, I think, but the code? (I am not a gesture expert) Sorry to disappoint, but I'm not that far (I have not encountered this need in my professional life) -
Please read all my post before posting this! I forgot nothing, you don't follow my steps. You miss the : It was an example, not involving date format. And this is SGBD dependent. So, it's not your field MyDateTime which is involved in the filter I wrote, but a computed column I named c_date, computed column you have to add to your table. You jump to a bad conclusion. Filter expression is not preprocessed I think, so you can't use {fn CONVERT(mydate,DATE)}
-
I think the problem is deeper. Using a FDquery (with parameter) instead of FDTable is for me the best solution, assuming your SGBD is MySQL SELECT * FROM mytable where DATE(MyDateTime)=:paramdate by then instead of a filter building and activating you only have to write something like FdQuery.Open('',[AdvDateTimePicker2.Date]); Contraction of fdquery.Close; fdquery.prambyname('paramdate').asDateTime:= AdvDateTimePicker2.Date ; fdquery.Open; Note to avoid flickering, surround the code with a fdQuery.DisableControls / Fdquery.EnableControls Another way if you want to use FDtable and Filter is to add to your DBtable (MySQL I assume) a generated column for example ALTER TABLE mytable ADD c_date integer AS (YEAR(mydate)*10000+MONTH(mydate)*100+DAY(mydate)) now you can use this computed column for your filter var dd,mm,yy : word; begin decodedate(advdatetimePicker2.date,yy,mm,dd); fdtable.filtered:=false; fdtable.filter:=Format('c_date=%d',[yy*10000+mm*100+dd]); fdtable.filtered:=true;
-
If it's a vote I use Flamerobin (light and open source) for all quick jobs including backup/restore, extracting data and more For design purpose (very rare) I used others *DBeaver (not so fine for firebird) but I appreciate ER Diagrams You can have a list of third party firebird tools here Do my Interbase reviews have anything to do with your choice? Keep in mind that some functionality of Interbase don't exist in Firebird (thinking about column crypto for example)
-
Yes, this is fine, I am a Firebird addict, but what if you want to migrate you Firebird App to mobiles (Androïd or IOS ?) Firedac can't do this ! Ok, there are others third-party components (ANyDac, ZEOSDBO) but keep this fact in mind. By the way, deploying Firebird on Androïd is a little messy
-
Hi, The goal, I have a text file with words and I want to export in a FDMemTable words with length between 4 and 12 ? I don't know how to get the value in onWriteRecord event, is there a way to ? I can get the value in the OnWriteValue one but fired after onWriteRecord it's unusefull. Any hints (not involving a localsql DELETE)
-
OK, found it! I need mappings and then my "filter" works procedure TDataModule2.FDBatchMove1WriteRecord(ASender: TObject; var AAction: TFDBatchMoveAction); var m : String; begin AAction:=TFDBatchMoveAction.paInsert; m:=FDBatchmove1.Mappings[0].ItemValue; accept:=(Length(m)>=4) AND (Length(m)<=12); if not Accept then AAction:=TFDBatchMoveAction.paSkip; end; My file text need a first line =column definition. I just have an encoding problem to solve (attached my file) and as you can see on image I have some problems like these zygopétale, zygopétales liste_de_mots.francais.frgut.txt
-
I disagree, it's entirely dependent on SGBD used Ok but you can use formatsettings function StrToDate(const S: string; const AFormatSettings: TFormatSettings): TDateTime;
-
Ah, I knew I faced this GetItemRect somewhere ! It was when I compare the new VCL TControlList to FMX.TListView. In fact, I was deploring the lack of the method (not lack but private one) GetItemRect (I found in FMX.TListview) in the VCL.TControlList Was not so old finally, but other context . (webinaire sur TControlList partie sur le dragdrop) I quickly check and "joy" got the same results No mousemove event will fire, I think. And tracking the movement of the finger should be a real challenge
-
Hi, I have to put water in my wine even though it's a wine heresy I just read that the interbase 2020 update 2 allows recursive CTEs https://docwiki.embarcadero.com/InterBase/2020/en/What's_New_in_InterBase_2020_Update_2 so I do a first try (with firebird) not a good one SQL but as first attempt not so bad WITH RECURSIVE R AS (SELECT CUSTNO,1 AS LNo,Item,Price FROM TABLE_1 UNION all SELECT r.CUSTNO,r.LNo+1,Item,Price FROM R WHERE r.LNo< (SELECT COUNT(*) LINES FROM TABLE_1 WHERE CUSTNO=r.CUSTNO) ) SELECT CUSTNO,LNO,item,price FROM r Give me a first look, not a good one but an approximation
-
Note : in case of headers/footers a loop in the items till item index shall certainly do the job. My question : what event will you used to detect drag mode ?
-
I don't found the source I had in mind, but ... If there are no headers or footers procedure TForm1.ListView1ItemClick(const Sender: TObject; const AItem: TListViewItem); begin if AItem.Purpose=TListItemPurpose.None then begin memo1.Lines.Clear; memo1.Lines.Add('Item width '+(Listview1.width).ToString); memo1.Lines.Add('real Item width '+(Listview1.width-Listview1.ItemSpaces.Left-ListView1.ItemSpaces.Right).ToString); memo1.Lines.Add('Item Height '+Listview1.ItemAppearance.ItemHeight.toString); memo1.Lines.Add('real Item height '+(Listview1.ItemAppearance.Itemheight-Listview1.ItemSpaces.top-ListView1.ItemSpaces.bottom).ToString); memo1.Lines.Add('cursor '+Listview1.ScrollViewPos.ToString); memo1.Lines.Add(' Item toppos in list '+(AItem.index*Listview1.ItemAppearance.ItemHeight-Listview1.ScrollViewPos).ToString); memo1.Lines.Add(' real Item toppos in list '+(AItem.index*Listview1.ItemAppearance.ItemHeight- Listview1.ScrollViewPos+Listview1.ItemSpaces.top).ToString); end; end; With this, it's easy to make a bitmap extracted from ListView1.MakeScreenShot like this procedure TForm1.ListView1ItemClick(const Sender: TObject; const AItem: TListViewItem); var aBitmap : TBitmap; rect : Trect; begin if AItem.Purpose=TListItemPurpose.None then begin Rect:=TRect.Create(TPoint.Zero); Rect.Left:=Trunc(ListView1.ItemSpaces.Left); Rect.Top:=trunc(AItem.index*Listview1.ItemAppearance.ItemHeight-Listview1.ScrollViewPos+Listview1.ItemSpaces.top); Rect.Right:=Rect.Left+Trunc(Listview1.width-ListView1.ItemSpaces.Right); Rect.Bottom:=Rect.Top+Trunc(Listview1.ItemAppearance.Itemheight-ListView1.ItemSpaces.bottom); aBitmap:=TBitmap.Create; try aBitmap.Width:=Rect.Width; abitmap.Height:=Rect.Height; aBitmap.CopyFromBitmap(Listview1.MakeScreenshot,Rect,0,0); aBitmap.SaveToFile('itemtest.bmp'); finally abitmap.Free; end; end; end; result : Ok, I just forget to discount Scrollbar width, but that's the idea
-
Yes, even if I don't remember how I proceed. I will look for in my ('old') sources code tests. I remember there are some private properties but, but these memories are polluted by more recent tests on VCL.TControlList (sorry) As soon as I find these sources, I come back.
-
Well, I install Interbase and was rather disappointed! No context variables (a bypass : using a temporary table) nor windows functions . I don't investigate for Recursive CTE, but I am afraid there is not. How can that be possible as of today? I understand more Ann Harrison mother of Interbase/Firebird point of view. As quick as I install Interbase, I desinstall it 😖 really disappointed. I have no doubt there are good things in Interbase but my way is now Firebird (event if missing some crypto columns)