Jump to content

Henry Olive

Members
  • Content Count

    73
  • Joined

  • Last visited

Everything posted by Henry Olive

  1. Delphi-XE dm.SDetail.Filtered:=False; if (SearchText[1]='*') then // SearchText comes from a variable with UPPERCASE begin Delete(SearchText,1,1); // Deleting * FilterText:='UPPER(ITEMNAME) CONTAINING '+QuotedStr(SearchText); end else FilterText:='UPPER(ITEMNAME) STARTS '+QuotedStr(SearchText); dm.SDetail.Filter:=FilterText; dm.SDetail.Filtered:=True; I'm getting Filter Expression Incorrectly Terminated. What is wrong ? Thank You
  2. Henry Olive

    Client Data Set FILTER

    Thank you so much aehimself, You are right we cant use SQL commands STARTS-CONTAINING in Filter Expressions. I used LIKE and SearchText+% LIKE and %+SearchText+% Thank you again.
  3. I wish everyone a healthy day Is there a away to prevent getting picture of a form ( Prevent Alt or Ctrl Print Screen ) ? Thank You
  4. Henry Olive

    SQL Integer Overflow

    Interbase, SELECT IM.ITEMNO, SUM(Case When IM.TNAME = 'Sell' then IM.QTY * (IM.UPRICE * IM.CURRRATE) else 0 end) FROM ITEMMOVEMENTS IM GROUP BY IM.ITEMNO I get Integer Overflow error msg. I Tried SUM(Case When IM.TNAME = 'Sell' then CAST(IM.QTY * (IM.UPRICE * IM.CURRRATE) AS NUMERIC(18,2)) else 0 end) I again get Integer Overflow error msg. I also tried CAST(SUM(Case When IM.TNAME = 'Sell' then IM.QTY * (IM.UPRICE * IM.CURRRATE) else 0 end) AS NUMERIC(18,2)) I again get Integer Overflow error msg. Any suggestion ? Thank You
  5. Henry Olive

    Prevent Alt or Ctrl + Print Screen

    Thank you so much everbody. Uwe you made me laugh (You are absolutly right !!)
  6. Henry Olive

    Prevent Alt or Ctrl + Print Screen

    What if the form shows digital Stamp & Signature ? My all other forms can make screen shot p.s : Even though i have below code on the form's OnCreate if dm.UsrRightADMINRIGHT.AsString ='No' then TabSheetStamp.TabVisible:=False;
  7. Henry Olive

    SQL

    I wish everyone a healthy day. Interbase-2007 I have below table ITEMNO.....TNAME......QTY...UPRICE AAA...............Buy..........10.........5,00 AAA...............Buy..........20.........5,00 AAA...............Sell............4..........7,00 AAA...............Return......2..........7,00 BBB...............Buy............6..........6,00 BBB...............Sell.............3..........8,00 CCC...............Buy.........12........10,00 Requested Result by (QTY * UPRICE) for each item ITEMNO.....TOTALBUY....TOTALSELL......TOTALRETURN AAA...................150,00..........28,00................14,00 BBB......................36,00...........24,00..................0,00 CCC...................120,00...........0,00.....................0,00 Thank You
  8. Henry Olive

    SQL

    Thank you so much Lajos, Stano
  9. Henry Olive

    SQL

    Thank you Bazzer747 Yes it is a question, How can i get requested result from the table by SQL ?
  10. Henry Olive

    Pos

    I wish everyone a healthy day. MyStr :='Lorem Ipsum '; I want to delete ALL empty/blank strings end of MyStr ( I dont know MyStr has how many empty strings ) Required Result :='Lorem Ipsum' Thank You
  11. Henry Olive

    Pos

    Thank you so much David
  12. 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
  13. 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
  14. 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.
  15. 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
  16. Henry Olive

    Disable DBComboBox

    Thank you so much Lajos
  17. 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;
  18. Henry Olive

    Getting Label Name from Label.Caption

    Thank you so much David
  19. 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
  20. Henry Olive

    SQL SubStr

    Thank you so much Dany
  21. 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
  22. 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);
  23. 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
  24. Henry Olive

    SQL Update

    Thank you so much Attila, If you have time can you please correct my code.
  25. 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
×