Jump to content

Henry Olive

Members
  • Content Count

    284
  • Joined

  • Last visited

Everything posted by Henry Olive

  1. Henry Olive

    Interbase - Update & Select

    Thank you so much Serge Unfortunatelly there is no recursive CTE in Interbase ( I'm planning to move Firebird ) I decided to create a Generator Thank you again
  2. Henry Olive

    Interbase - Update & Select

    Thank you Hanetchman i just wondered if it is possible to insert SQL ( not proc) with one of a field with auto counter (like generator, but w/o created any generator) Thank you so much Danny for your detailed explanation i really appriciate for the time you spent for me.
  3. Henry Olive

    SQLDataset.SortFieldNames

    I wish everyone a healthy day. I have a Master-Detail tables (Components : SQLDataset+DSProvider+ClientDataset+D.Source) 2 table's comman field is ID field, Detail Table Primary Keys are ID,LINENO, In my Detail table i have a SQL Command *w/o any ORDER BY clause* But i want to show the detail table's datas in a DBGrid with sorted (ITEMNO) Even though SQLDataset's SortFieldNames=ITEMNO but it doesnt sort How can i show detail table's data in a dbgrid with ITEMNO sorted **without add CommandText ORDER BY ITEMNO clause.** (P.s : If i add commandtext ORDER BY ITEMNO it works ) Thank You
  4. Henry Olive

    SQLDataset.SortFieldNames

    I solved the problem I wrote just ITEMNO in the sortfieldname instead of OD.ITEMNO ( SortFieldName requires field name *with Alias* in the CommandText) Thank You
  5. 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
  6. Henry Olive

    Interbase Update

    Thank you so much Stano and Serge I used Trigger as Serge's suggestion
  7. 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
  8. 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;
  9. Henry Olive

    Interbase Trigger

    Thank you so much CorneliusDavid, SkyzoFrame
  10. 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
  11. 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
  12. Henry Olive

    Re-Index a PageControl.PageIndex

    THANK YOU SO MUCH David, Lajos, Pat
  13. 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
  14. 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
  15. 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
  16. Henry Olive

    Sql

    You are right, i added TNAME to see what will happen & i forgot it Thank you so much
  17. 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
  18. 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
  19. 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
  20. 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
  21. Henry Olive

    Trim, SplitString

    Thank you so much Rollo62, Mvanrijnen
  22. 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
  23. Henry Olive

    Pos

    Thank you Stefan
  24. 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
  25. Henry Olive

    Disable & re-Enable a Procedure

    Thank you so much Corneli dm.OrdersDOCNO.OnChange := nil; dm.OrdersDOCNO.OnChange := OrdersDOCNOChange; works
×