Jump to content

Henry Olive

Members
  • Content Count

    330
  • Joined

  • Last visited

Everything posted by Henry Olive

  1. Henry Olive

    Interbase Update

    I wish everone a healthy day. Master Table looks like below ID.....STATUS 1..... 'Planned' Detail Table looks like below ID......ITEMNO....QTY 1........AAA..............4 1........BBB...............2 1........CCC...............1 ItemCard Table looks like below ITEMNO.....RESERVED AAA...............4 BBB................2 CCC................1 When i change Master Table's STATUS from 'Planned' to 'Finish' then I want to update ItemCard table's Reserved fields (Dicrease reserved qtys as Detail table's quantities). that is after Status =Finish then ItemCard table results should be like below ITEMNO.....RESERVED AAA...............0 BBB................0 CCC................0 Could someone please help me. Thank You
  2. Henry Olive

    Interbase Update

    Thank you so much Stano and Serge I used Trigger as Serge's suggestion
  3. Henry Olive

    Interbase Update

    Thank you so much Stano No need any JOIN ? ( ItemCard & DetailTable ) How can i get ITEMNO params ('AAA','BBB','CCC') ? If you have time could you please write the SQL ? Thank you
  4. Henry Olive

    Interbase Trigger

    I wish everyone a healthy day. I have below INTERBASE Trigger. Eventhough i had no problem creating the trigger it doesnt work as expected ( I fill RESERVQTY ( value=2) when running the program by myself, after post when i check RESERVQTY's value in the Database i see the value =2 but trigger Doesnt write ITEMS table's ORDRESERVE field anything, Should have been 2 ) What am i doing wrong ? Thank You CREATE TRIGGER "ORDETRESERVE_INS" FOR "ORDETAIL" ACTIVE AFTER INSERT POSITION 0 AS begin IF (New.RESERVQTY > 0) THEN UPDATE ITEMS SET ORDRESERVE = (COALESCE(ORDRESERVE,0) + New.RESERVQTY) WHERE ITEMNO = New.ITEMNO; end;
  5. Henry Olive

    Interbase Trigger

    Thank you so much CorneliusDavid, SkyzoFrame
  6. I wish everyone a healthy day. My Portal Table : Company...PortalAdress...........UserName...Password XXX...............Https://xxx.com.....xxx..................xxx To login the customer portal in my apllication I created a form with a TWebbrowser, I can connect any website w/o any problem I wonder, when i connect any customer's portal can i AUTO fill UserName & Password of the portal enterance form ? Thank You
  7. I wish everyone a healthy day. My PageControl looks like below TabSheet1-TabSheet2-TabSheet3-TabSheet4-TabSheet5-TabSheet6....... In some case i need to make TabSheet3 and/or TabSheet4 Invisible I wrote below codes TabSheet3.TabVisible := CDS1UserRight1.asString ='Y'; //User has no Right for this Tab so it is UNvisible TabSheet4.TabVisible := CDS1UserRight2.asString ='Y'; //User has no Right for this Tab so it is UNvisible In this case i need to re-arrange the PageControl1.PageIndexes so i wrote below codes for i:=0 to PC1.PageCount-1 do begin if PC1.Pages.TabVisible=True then PC1.Pages.PageIndex := i; end; Above codes works w/o any errror but I expected to see TabSheet1-TabSheet2-OLDTabSheet5(New TabSheet3) -OLDTabSheet6(NewTabSheet4) **Contents of TabSheets are correct** but their captions are wrong ( I see Invisible TabSheets Captions) What am i doing wrong ? Thank You
  8. Henry Olive

    Re-Index a PageControl.PageIndex

    THANK YOU SO MUCH David, Lajos, Pat
  9. Henry Olive

    Re-Index a PageControl.PageIndex

    Thank you so much Uwe for your reply. First I'm so sorry for my poor english may be i cant express my problem good. My PageControl's owner draw = True; May be problem occurs from this proc. // Below proc it self works w/o any problem procedure TMainForm.PC1DrawTab(Control: TCustomTabControl; TabIndex: Integer; const Rect: TRect; Active: Boolean); var XTabSheet: TTabSheet; XRect: TRect; FormColor: String; begin if Active then begin Control.Canvas.Brush.Color:=$006ED7FC; Control.Canvas.Font.Color:=clBlack; end else begin FormColor :=dm.SettingsFormColor.AsString; if MatchText(FormColor,['Windows','Gray']) then Control.Canvas.Brush.Color:=$003C3838 else if MatchText(FormColor,['Brown','Light Brown']) then Control.Canvas.Brush.Color:=$0034527E; ...... end; XRect:=Rect; Control.Canvas.FillRect(XRect); XTabSheet:=PC1.Pages[TabIndex]; DrawText(Control.Canvas.Handle, PChar(XTabSheet.Caption), length(XTabSheet.Caption), XRect, DT_VCENTER + DT_SINGLELINE + DT_CENTER); end; Lets say i have a PageControl and 4 Tabsheets When i try to make INVISIBLE TabSheet3 and Tabsheet4 *i have no problem* (they are last tabsheets !!) but when i make invisible Tabsheet2 and Tabsheet3 ( In RunTime ) Eventhough I expect to see Tabsheet1 - TabSheet4 (TabSheet4's caption is still Tabsheet2 but contents are Correct ) Thank You
  10. Henry Olive

    Locate

    I wish everyone a healthy day. My Table AAAA-01X BBBB-02X CCCC-03X Is there a way to Search & Locate a record like with just '02' searchtext ( that is i want to locate BBBB-02X ) I tried below code but no success SearchText:='02'; if not Dataset.Locate(SERIALNO, SearchText, [LoCaseInsensitive,LoPartialKey]) then ShowMessage ('...........') I need something like Sql's CONTAINING ( I dont want to Filter or SQL, just i need is Locate ) Thank You
  11. Henry Olive

    Sql

    I wish everyone a healthy day Interbase Months Table SMonth....LMonth 1...................January 2...................February .... Invoice Table ID.....CUSTNO...TNAME.....TOTAL......SMONTH 1.................20..........Buy.............5,000.................1 2.................20..........Buy.............8,000.................2 3.................20..........Sell...........10,000.................1 4.................20..........Sell.............5,000.................2 5.................20..........Sell.............6,000.................2 I'm trying to get below result for CustomerNo 20 LMONTH.......TOTALBUY....TOTALSELL January................5,000............10,000 February..............8,000............11,000 I tried below sql with no success SELECT M.LMONTH, Case When I.TNAME='Sell' then SUM(I.TOTAL) end as TOTALSELL , Case When I.TNAME='Buy' then SUM(I.TOTAL) end as TOTALBUY FROM INVOICE I JOIN MONTHS M ON M.SMONTH=I.SMONTH WHERE CUSTNO=20 GROUP BY M.LMONTH, I.TNAME Can someone please help Thank You
  12. Henry Olive

    Sql

    You are right, i added TNAME to see what will happen & i forgot it Thank you so much
  13. Henry Olive

    Sql

    Thank you so much Lajos I get below result with your code LMONTH.......TOTALBUY....TOTALSELL January................5,000.........................0 January.........................0..............10,000 February..............8,000.........................0 February.......................0..............11,000 I want below result LMONTH.......TOTALBUY....TOTALSELL January................5,000............10,000 February..............8,000............11,000
  14. I wish a healthy day to everyone MyTable : DOCNO (it is an Integer Field) --------- 1285 1286 ...... I want to UPDATE my table and add shortyear begining of DOCNO. like below DOCNO --------- 211285 211286 ...... Thank You
  15. Henry Olive

    Sql-Add Number begining of an INT field

    Thank you everybody. I'm so sorry i forgot to mention Db Server, It is INTERBASE
  16. Henry Olive

    Trim, SplitString

    I wish everyone a healthy day. I have a DIMENSION data as a string like '10*20*30' I want to get each dimension number if user doesnt put empty string between the numbers like(10*20*30) there is no problem but if user put empty string between the numbers like (10 * 20 * 30) then i cant get correct result procedure TForm1.Button1Click(Sender: TObject); var i: Integer; Str, Seperator : String; begin Edit1.Text := '10 * 20 * 30'; Str := Trim(Edit1.Text); // i hoped that Trim removed the empty strings that is converted the Str to 10*20*30 but no for i := 1 to Length(Str) do if Str in ['*'] then begin Seperator := Str; Break; end; Edit2.Text := SplitString(Str,Seperator)[0]; Edit3.Text := SplitString(Str,Seperator)[1]; Edit3.Text := SplitString(Str,Seperator)[2]; end; Thank You
  17. Henry Olive

    Trim, SplitString

    Thank you so much Rollo62, Mvanrijnen
  18. Henry Olive

    Pos

    I wish everyone a healthy day. Edit1.Text := 22/333/44444 ( Not fix can be change, could be 1/2/6) I want to get below result firstnumber:= 22 secondnumber := 333 thirdnumber := 44444 Thank You
  19. Henry Olive

    Pos

    Thank you Stefan
  20. I wish everyone a healthy day. I have below procedure procedure TDm.OrdersDOCNOChange(Sender: TField); begin .... end; How can i disable & re-enable this proc.? I tried dm.Orders.DOCNOChange := Nil; // Err.Msg = Undeclared identifier: 'DOCNOChange' Thank You
  21. Henry Olive

    Disable & re-Enable a Procedure

    Thank you so much Corneli dm.OrdersDOCNO.OnChange := nil; dm.OrdersDOCNO.OnChange := OrdersDOCNOChange; works
  22. Is there an easy way to get Alfabetical (English) order number of a letter like C=3 , E=5 , H=8 .... Thank You
  23. Henry Olive

    Alfabetical order of a letter

    Thank you so much Vandrovnik, David, Lars My excel sheet always has 12 columns no more Vandrovnik, with below code I get Low cannot be applied to a long string err.msg. Str := Edit1.Text; // Edit1..Text:='D' Num := Ord([Low(Str)]) - Ord('A') + 1; Edit2.Text := IntToStr(Num); But below code WORKS Num := Ord(Str[1]) - Ord('A') + 1; Thank you so much
  24. Henry Olive

    Alfabetical order of a letter

    Thank you Vandrovnik, eivind From an Excel Sheet i get column name ( for example F ) then i need to convert F to an integer number ( which is 6 ) so that i can import some datas from excel to my dataset. Str:=Edit1.Text; // Which is D Num := Ord(PChar(Str)) - Ord('A')+1; Edit2.Text := IntToStr(Num); I'm getting 37266172 instead of 4
  25. Henry Olive

    Alfabetical order of a letter

    Thank you Lajos, if Edit1.Text ='A' then // (Edit1.Text =D) Edit2.Text := '1' else Edit2.Text := IntToStr(ord(Edit1.Text) - ord('A')+1); Expecting 4 but getting 37266172 with below code i get correct result ShowMessage(IntToStr(Ord('D') - Ord('A')+1));
×