Jump to content

Henry Olive

Members
  • Content Count

    302
  • Joined

  • Last visited

Everything posted by Henry Olive

  1. Henry Olive

    HoursBetween

    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
  2. Henry Olive

    HoursBetween

    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;
  3. Henry Olive

    HoursBetween

    Thank You Peter I edited my last post 6 minutes ago if you can check i tried also 24:00
  4. Henry Olive

    HoursBetween

    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
  5. Henry Olive

    HoursBetween

    Thank you SO MUCH Peter, Uwe
  6. Henry Olive

    HoursBetween

    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
  7. Henry Olive

    FB-3 Create a New Table

    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
  8. Henry Olive

    Round

    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
  9. Henry Olive

    Round

    Thank you so much Lajos, David David, yes it is a Currency
  10. Henry Olive

    FB-3 Delete

    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
  11. Henry Olive

    FB-3 Delete

    Thank you SO MUCH Serge
  12. Henry Olive

    FB-3 Delete

    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.
  13. Henry Olive

    FB-3 Delete

    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 )
  14. Henry Olive

    Function with 2 return values ?

    Thank You So Much Serge, Cristian, Uwe, David, Andrea, Frost.Brutal, Stefan, Leif, Bill, Gustav
  15. Henry Olive

    ClientDataSet Locate

    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
  16. Henry Olive

    ClientDataSet Locate

    Thank You Lajos
  17. Henry Olive

    FB3 Update

    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
  18. Henry Olive

    FB3 Update

    Thank you so much tgbs
  19. Henry Olive

    FB3 Update

    Thank you SO SO SO much Serge Your code is shorter & faster
  20. Henry Olive

    FB3 Update

    Thank you So Much Serge What you mean by ACCACCOUNT table description ? ACCAccount table is like below ACCCODE, DEBIT, CREDIT
  21. Henry Olive

    Delphi10.3 - FB3 - Firedac BackUp

    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
  22. Henry Olive

    Split String

    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
  23. Henry Olive

    Split String

    Thank you SO MUCH Serge
  24. Henry Olive

    Split String

    Thank You Sherlock, SwiftExpat Thank You SO MUCH Peter
  25. Henry Olive

    FB-3 SELECT WHERE

    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
×