Jump to content

Henry Olive

Members
  • Content Count

    284
  • Joined

  • Last visited

Everything posted by Henry Olive

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

    Disable DBComboBox

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

    Getting Label Name from Label.Caption

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

    SQL SubStr

    Thank you so much Dany
  7. 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
  8. 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);
  9. 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
  10. Henry Olive

    SQL Update

    Thank you so much Attila, If you have time can you please correct my code.
  11. 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
  12. 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
  13. Henry Olive

    Interbase Get Days count of a month

    I wish everyone healthy days. I want to get day count of a month for example, for january=31 for february=28 (in 4 years it is 29) for April=30 I tried SELECT EXTRACT (DAY FROM current_date) FROM rdb$database where extract(month FROM current_date)=2 but not correct. Thank You
  14. Henry Olive

    SQL Update Case When

    Interbase 2007 CREATE PROCEDURE EMPTAXBASE ( TMONTH SMALLINT) AS declare variable EMPPORTION NUMERIC(12, 5); begin SELECT EMPPORTION FROM COMPANY INTO :EMPPORTION; UPDATE EMPLOYEE SET TAXBASE= Case When SHAREHOLDER='Y' then (BRUTSALARY * :EMPPORTION /100) * :TMONTH End end I'm getting 'Token Unknown end' error ( which is the LAST end, the other is End ) what am i doing wrong ? Thank You
  15. Henry Olive

    SQL Update Case When

    Stano, Thank You SO SO MUCH for your help, i solved the problem There were 2 problems 1=Case should have been between Parentheses 2=At the end of statement there should have been ; (Case when aa then bb else cc end) ;
  16. Henry Olive

    SQL Update Case When

    I created a simple S.Proc in EMPLOYEE Database If someone has 5 minutes time may be he can try to create below s.proc. This proc also gives error 'Token unknown - line 12, char -1 end' CREATE PROCEDURE TEST AS DECLARE VARIABLE MYCOUNTRY VARCHAR(40); begin SELECT COUNTRY FROM COUNTRY WHERE COUNTRY='Fiji' INTO :MYCOUNTRY; UPDATE CUSTOMER SET COUNTRY = Case When COUNTRY='USA' then :MYCOUNTRY When COUNTRY <> 'USA' then COUNTRY End end
  17. Henry Olive

    SQL Update Case When

    Thank you so much Stano I noticed that you made a typo mistake I added *as* after End (Case's End) like : as MYRESULT End error is Token Unknown as
  18. Henry Olive

    SQL Update Case When

    Thank you so much Stano I added 'as MyResult' after Case's End This time i get 'Token Unknown' as error
  19. Henry Olive

    SQL

    I wish everyone a healthy day SELECT EMPNO,EMPNAME, PRIORTAXBASE, BRUTSALARY, Case When SHAREHOLDER='Y' then (PRIORTAXBASE + BRUTSALARY) When RETIRED='Y' then (PRIORTAXBASE + BRUTSALARY)- ((PRIORTAXBASE + BRUTSALARY) * 4 /100) + When (SHAREHOLDER IS NULL or SHAREHOLDER='N') then (PRIORTAXBASE + BRUTSALARY) - ((PRIORTAXBASE + BRUTSALARY) * 0.18) end as TAXBASE /* Upper SQL works fine, Here below i want to use TAXBASE (upper result) like below */ Case When TAXBASE <= 30000 then TAXBASE * 20 When TAXBASE >30000 and TAXBASE <=50000 then TAXBASE * 30 .... end as TAXTOTAL from EMPLOYEE Thank You
  20. Henry Olive

    SQL

    Thank you so much Stano, I'm so sorry, i forgot to add my message that i use IB-2007 and IB-2007 doesnt have Common Table Expression In this case i think there is no chance WITHOUT a view or S.PROC Again i'm so sorry.
  21. Henry Olive

    Interbase Get Days count of a month

    Thank you so much Stano, Jeff, EmailX45
  22. Henry Olive

    Sql Delete

    I wish everyone a healthy day Interbase DELETE FROM MDETAIL MD JOIN ITEMS IT ON MD.ITEMNO=IT.ITEMNO WHERE MD.RNO=120 and IT.ITEMTYPE ='001'; I'm getting token unknown JOIN err.msg Thank You
  23. Henry Olive

    Sql Delete

    Thank you so much Joachimd
  24. Henry Olive

    Open File Location

    My table's FILEPATH.Value:='\\MySRV\MyFiles\Oraxxo.Txt'; I want to open above file location in windows explorer I know how to open (run) the file, i just need source location in windows explorer Thank You
  25. Henry Olive

    Open File Location

    Thank you so much Gunther
×