Henry Olive
Members-
Content Count
302 -
Joined
-
Last visited
Everything posted by Henry Olive
-
Thank You so much David User enters the StartTime & EndTime by hand ( by choosing from the combox Items) Each ComboBoxes has Items 17:30, 18:00 19:00 ... 24:00 Between 17:30 to 24:00
-
Here below my codes procedure TForm2.Button1Click(Sender: TObject); var ST,ET : TDateTime; Diff : Double; begin if (ComboBox1.Text='') or (ComboBox2.Text='') then Exit; ST := StrToDateTime (ComboBox1.Text); '17:30' ET := StrToDateTime (ComboBox2.Text); '24:00' Diff := MinutesBetween(ET,ST) / 60; Edit1.Text := FloatToStr(Diff); end;
-
Thank You Peter I edited my last post 6 minutes ago if you can check i tried also 24:00
-
Good Day, ST := Start Time ET := End Time What if ST:='17:30' and ET :='00:00' (The Difference should be 6,50 but i get 17,50) If i change '00:00' to '12:00' this time the Difference is 5,50 not 6:50 if i change '00:00' to '24:00' then this time 24:00 is not valid datetime error msg. Thank You
-
Thank you SO MUCH Peter, Uwe
-
Thank you so much Tom, Stano Stano, i know TDateTimePicker is good solution but i want to learn to get time difference between 2 strings
-
Good Day, I have an exisiting table (MyTable) , i'd like to create a new table exactly the same MyTable with different name Is there any command for this in Firebird 3 ? something like Create Table MyTable2 LIKE MyTable Thank You
-
Good Day, D-10,3 Edit1.Text := 10,36 MyVariable := 10,36758 I want to change MyVariable to exactly the same as Edit1.Text (10,36) I want to keep just 2 numbers after comma ( , ) Thank You
-
Thank you so much Lajos, David David, yes it is a Currency
-
Good Morning, DELETE FROM ORDETAIL OD JOIN ORDERS O ON O.ID = OD.ID WHERE OD.REMAINQTY = 0 and O.INVDOCNO IS NOT NULL What is the correct SQL code of my above wrong SQL code ? Thank You
-
Thank you SO MUCH Serge
-
Thank You Stano I change my question How to delete a detail table record according to both Master & Detail tables's some field values ? For example DELETE FROM ORDETAIL OD WHERE OD.REMAINQTY=0 Above code works but i also want to add into above code an additional condition from Master Table which is something like AND ORDERS.INVDOCNO IS NOT NULL One condition from Detail table second condition comes from Master Table If both conditions occur then i'll delete detail record.
-
Thank You Stano I dont have foreign key, First i want to delete detail record if the condition is met then i'll delete master record like below Delete From Orders O Where Not Exists (Select * from OrDetail OD Where O.ID=OD.ID )
-
Function with 2 return values ?
Henry Olive replied to Henry Olive's topic in RTL and Delphi Object Pascal
Thank You So Much Serge, Cristian, Uwe, David, Andrea, Frost.Brutal, Stefan, Leif, Bill, Gustav -
Good Day, Delphi 10.3 My Table looks like below ID ABC-0001 ABC-0002 ABC-0003 Is there a way to Locate a record just with last characters For Example SearchText := '0002' CDS1.Locate ('ID', QuotedStr(SearchText), [LoPartialKey]); Above Locate code doesnt works ! Thank You
-
Thank You Lajos
-
Good Day, I want to Update a target table according to a Master Detail table records. I wrote 2 Stored Procs. 1 for Update a Single record in target , the other for Update All records in target Here below my 2 s.procs, both works, but i'd like to be sure and need an expert confirmation Could someone please help.? /* For single 1 record update s.proc */ ALTER PROCEDURE UPDATEACC_SINGLE ( ACCCODE VARCHAR(20), ACTIVEYEAR VARCHAR(4) ) AS BEGIN IF (ACCCODE IS NULL) THEN EXIT; UPDATE ACCACCOUNT SET DEBIT= (SELECT SUM(AD.DEBIT) FROM ACCRECDETAIL AD JOIN ACCRECEIPT AR ON AD.RNO=AR.RNO WHERE AD.ACCCODE=:ACCCODE and EXTRACT(YEAR FROM AR.TDATE)=:ACTIVEYEAR), CREDIT= (SELECT 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); END /* For all records update s.proc */ ALTER PROCEDURE UPDATEACC_ALL ( ACTIVEYEAR VARCHAR(4) ) AS begin UPDATE ACCACCOUNT AC SET AC.DEBIT=(SELECT SUM(AD.DEBIT) FROM ACCRECDETAIL AD JOIN ACCRECEIPT AR ON AR.RNO=AD.RNO WHERE AR.RNO=AD.RNO and AD.ACCCODE=AC.ACCCODE and EXTRACT(YEAR FROM AR.TDATE)=:ACTIVEYEAR), AC.CREDIT=(SELECT SUM(AD.CREDIT) FROM ACCRECDETAIL AD JOIN ACCRECEIPT AR ON AR.RNO=AD.RNO WHERE AR.RNO=AD.RNO and AD.ACCCODE=AC.ACCCODE and EXTRACT(YEAR FROM AR.TDATE)=:ACTIVEYEAR); end Thank You
-
Thank you SO SO SO much Serge Your code is shorter & faster
-
Thank you So Much Serge What you mean by ACCACCOUNT table description ? ACCAccount table is like below ACCCODE, DEBIT, CREDIT
-
Good Morning, I use FireDac BackUp component w/o any problem but, When i backup my data ( 3MB ) my backup file is also 3MB I asked this question a couple of months ago here Mr.Serge replied me (Thank you again) and said it is normal. Yesterday this situation came to my mind & researched in google but i couldnt find any information then i checked Delphi 10.3 sample projects and found a FireDac Samples project included BackUp, Restore components I tested to backup my project in sample firedac backup project and i noticed the backup file's size is nearly 1MB (1/3 of the original data which i expected) then i compared sample project and Delphi 10.3 component pallet's BackUp components i noticed they are different, for example 1- Sample project's backup component doesnt has DIRECT property but Delphi 10.3 has 2- Sample project's backup component's Option is totally different then Delphi 10.3 I tried to change DIRECT property value to Off ( Originally it was ndDefault ) and i tried a new backup this time my backup file is nearly 1,5MB ( 1/2 of the original data ) I'm confused. Could someone please help me What is DIRECT property & what does they mean (nbDefault, On, Off ) Thank You
-
Good Day, MyCode in Database = VARCHAR(20) MyCode could be (120 or 250) like 3 digit Integer, or (200.001 or 600.010) there is a dot between numbers, or (500.005.0010 or 100.010.1500) there are 2 dots between numbers I need to Increase MyCode by 1 that is if MyCode = 100 then requested result = 101 if MyCode = 300.001 then requested result = 300.002 if MyCode = 600.005.0010 then requested result = 600.005.0011 How can i do that ? Thank You
-
Thank you SO MUCH Serge
-
Thank You Sherlock, SwiftExpat Thank You SO MUCH Peter
-
Good Day, My Table : ID...TNAME..TDATE................INVNO 1......AA...........01/06/2022 2......BB............01/06/2022.........22 3......AA...........02/06/2022.........33 4......AA...........10/06/2022.........44 Requested Result : ID....TNAME.....TDATE..................INVNO 1........AA.............01/06/2022 4........AA............10/06/2022..........44 Lets say today = 13/06/2022 (dd/mm/yyy) and i want to show TNAME='AA' and INVNO IS NULL (Whatever TDATE is ) **or** INVNO IS NOT NULL but TDATE >= 03/06/2022 ( All 10 Days old records ) My Sql : SELECT * FROM MYTABLE WHERE TNAME IN ('AA') and (TDATE >= (SELECT MAX(TDATE) FROM MYTABLE ) - 10 or (X.INVRNO IS NULL)) with above Sql i dont see ID=4 record (Its INVNO is not null BUT Its Date is just 3 days old, that is i should see it ) Thank You