Jump to content

Henry Olive

Members
  • Content Count

    62
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Henry Olive

    DBEdit.Items

    I wish everyone a healthy day. I have a DBEdit & Its has 1 item 'Abc' (Style = csDropDown) But in another record i also want to write something in to DBEdit by hand '123' If i write DBEdit by hand after close & re-open the form even though I see the record in the database.(written by hand value) i cant see the DBEdit.Text (Field Value) which i filled by hand 1 minute ago what is wrong ? Thank You
  2. Henry Olive

    SQL with Sum & Case

    Thank you so much Virgo. IB-2007 doesnt have CTE & Derived table I solved my problem in Delphi side, adding a Calc Field into Query result.
  3. Henry Olive

    SQL with Sum & Case

    I wish everyone a healthy day. Interbase 2007 SELECT C.CUSTNO, C.CUSTNAME, SUM (CM.DEBIT-CM.CREDIT)BALANCE, Case When CAST(SUM (CM.DEBIT-CM.CREDIT) AS NUMERIC(15,2)) > 0 then 'Debit' else 'Credit' end as STATE FROM CUSTMOVEMENTS CM /* it is a View */ LEFT JOIN CUSTOMER C ON CM.CUSTNO=C.CUSTNO WHERE CM.TDATE <= '03/30/2021' GROUP BY C.CUSTNO, C.CUSTNAME HAVING SUM (CM.DEBIT-CM.CREDIT) <> 0 In the Results, BALANCES are correct but some State is wrong CustNo...CustName........Balance.....State 1.................AAA.......................1000.......Debit (Correct) 2.................BBB....................... 2000.......Credit (should have been Debit) 3.................CCC..................... -3000.......Debit (should have been Credit) I had to use CAST in above sql because if i dont use it i get Bad BLR Invalid Stream error msg. What am i doing wrong ? Thank You
  4. Henry Olive

    Disable DBComboBox

    Thank you so much Lajos
  5. Henry Olive

    Disable DBComboBox

    I wish everyone a healthy day. I have DBComboBox1 with 2 Items (Open, Closed) I have another DBComboBox2 which it is Field Name=ClosedDate I dont want user to fill Closed Date Field if DBComboBox1.Text=Open So I wrote below code DBComboBox2.Enabled :=DBComboBox1.Text='Closed'; Which event is the best place to put above code ? Thank You
  6. Henry Olive

    Getting Label Name from Label.Caption

    Thank you so much David
  7. I have 6 Labels on my form I need to fill them according to a query result but i dont know how many data returns ( may be NONE may be 1 may be 6 ( which is MAX) I wrote below codes var MyLabel : TLabel; while not Query1.Eof do begin if Query1.Fields[0].AsString <> '' then begin MyLabel.Caption :=Query1.Fields[0].AsString + ' - Responsible :'; MyLabel.Caption := dm.GetNextDocNo(MyLabel.Name); // i find next label.caption // Above dm.GetNextDocNo function Increases number in a string) which works well // for example if MayLabel.Name ='Label1' then this function makes it 'Label2' so on // My problem is in below how can i get Label.Name from Label.Caption ? // so that I can fill other labels ? MyLabel := ??? end; Query1.Next; end;
  8. Henry Olive

    SQL SubStr

    Thank you so much Dany
  9. Henry Olive

    SQL SubStr

    I wish everyone a healthy day. Interbase 2007, SELECT ARD.CODE,ARD.DEBIT,ARD.CREDIT FROM ACCRECDETAIL ARD JOIN ACCRECEIPT AR ON AR.RNO=ARD.RNO WHERE (ARD.CODE >= SUBSTR('180',1,3)) and (ARD.CODE <= SUBSTR('190',1,3)) Above SQL works but i can get Codes between '180' and '189' NOT 190 If i change WHERE CLAUSE like below i can get all records Code between '180' and '190' WHERE (ARD.CODE >= SUBSTR('180',1,3)) and (ARD.CODE <= SUBSTR('191',1,3)) /* I changed 190 to 191 */ What is wrong ? Thank You
  10. Henry Olive

    SQL Update

    Thank you Attila, I changed the SQL like below but still getting multiple rows err. UPDATE PAYROLL1 P SET P.CUSTACCRNO=(SELECT C.RNO FROM CUSTACC C WHERE C.CUSTNO=P.CUSTNO ) WHERE EXISTS (SELECT 1 FROM CUSTACC C1 WHERE C1.CUSTNO=P.CUSTNO);
  11. Henry Olive

    SQL Update

    PayRoll Table CustNo...CUSTACCRNO 1 Null 2 Null Target Table CUSTACC RNO CUSTNO 101 1 102 2 Iwant to fill PayRoll's CUSTACCRNO fields according to CUSTACC RNO values. After UPDATE The result of Payroll table should be CustNo...CUSTACCRNO 1 101 2 102
  12. Henry Olive

    SQL Update

    Thank you so much Attila, If you have time can you please correct my code.
  13. Henry Olive

    SQL Update

    Interbase; UPDATE PAYROLL P SET P.CUSTACCRNO=(SELECT C.RNO FROM CUSTACC C WHERE C.CUSTNO=P.CUSTNO); I'm getting multiple rows in singleton select err.msg. Thank You
  14. Henry Olive

    Getting SUM of a Calculated Field

    Thank you so much Dany, var MyCalcField : Double (CDS1 =Client Dataset;) MyCalcField :=(CDS1A.asFloat + CDS1B.asFloat + CDS1C.asFloat) - (CDS1D.asFloat + CDS1E.asFloat); Now i want to get Sum of MyCalcField (Total result of MyCalField) and I want to do this process in Delphi CDS1 View : EmpName MyCalcField AAA...........................5,000 BBB............................6,000 I need to get 5000 + 6000 = *11,000 result* I know i can make this with a SQL and i can make scan the CDS1 (While not CDS1.Eof do ... ) I thought may be there could be a better way to do this in Delphi
  15. Henry Olive

    Getting SUM of a Calculated Field

    I wish everyone a healthy day. How can i get get SUM of a calculated field ? I have a TOTAL field which is calculated. I want to get SUM of TOTAL and write the result in a Label or DBtext p.s : I know i can do it While Not CDS1.Eof ... I wonder is there a better way Thank You
×