Jump to content

Henry Olive

Members
  • Content Count

    302
  • Joined

  • Last visited

Everything posted by Henry Olive

  1. Henry Olive

    VCL DB App. To Cloud

    Good Day Delphi : 10.4 Is there any program that converts a Vcl Db Appl. to Cloud ? If not which solution is best in Delphi (RadServer etc...) Thank You
  2. Henry Olive

    Excel Get Column Number

    Good Day I'm trying to Import Datas from Excel into a table When i scan the excel sheet i need to know in which column i am var Sheet, Book : Variant; begin Book:= ExcelApp.WorkBooks.Open(OD1.FileName); Sheet := Book.Worksheets[1]; for Col:= Low to High do begin if Sheet.Cell.Column = 2 then // (i need to get column number here), ERROR Method Cell not supported doThis; end; end;
  3. Henry Olive

    Excel Get Column Number

    Thank you so much DelphiUdit, DieHollander
  4. Good Day Str := 'Abc' or could be Abc First, I want check if first char = ' then i want to delete it Second I want check if Last char = ' then i also want to delete it that is, if Str='Abc' then the result should be Abc if Str = Abc then i dont need to do anything Thank You
  5. Henry Olive

    Delete First & Last Character

    Thank you so much Jon, Remy
  6. Good Day I want to make a FOLDER Hidden then turn to Normal but i get an error (error point below) What am i doing wrong ? Thank You procedure TFolderss.btnHiddenClick(Sender: TObject); var FileName : String; attributes: TFileAttributes; begin FileName := FoldersFOLDERPATH.AsString; attributes:= TFile.GetAttributes(FileName); Include(attributes,TFileAttribute.faHidden); Here i get [dcc64 Error] UFolders.pas(103): E2003 Undeclared identifier: 'attributes ' TFile.SetAttributes(FileName, attributes); end; procedure TFolderss.btnNormalClick(Sender: TObject); var FileName : String; attributes: TFileAttributes; begin FileName := FoldersFOLDERPATH.AsString; attributes:= TFile.GetAttributes(FileName); Exclude(attributes,TFileAttribute.faNormal); TFile.SetAttributes(FileName, attributes); end;;
  7. Henry Olive

    Get, Set FileAtrributes

    This time i get below error msg FileName :='C:\TEST PROG -> This is FOLDER not FILE attributes:= TFile.GetAttributes(FileName); // Error Msg = The specified file was not found Could be there is still any hidden unicode character ? ( My Form FileFormat shows ANSI ) Thank You
  8. Henry Olive

    Get, Set FileAtrributes

    Thank You SO MUCH Lajos
  9. Good Day I want to make a **Folder** ReadOnly or Hidden and then change to Normal I tried below codes for ReadOnly and Normal but i got below err.msg var attributes: TFileAttributes; attributes := TFile.GetAttributes(CDS1FOLDERPATH.AsString); ReadOnly : Include(attributes, faReadOnly); // ERROR E2010 Incompatible types: 'TFileAttribute' and 'TFieldAttribute' TFile.SetAttributes(CDS1FOLDERPATH.AsString, attributes); Normal : Exclude(attributes, faReadOnly); TFile.SetAttributes(CDS1FOLDERPATH.AsString, attributes); Hidden :
  10. Henry Olive

    Ord Funcition

    Good Day I'm trying to get a char's alphabetic order number for example A=1, C=3... etc. Edit2.Text := IntToStr(Ord(Edit1.Text)); with above code I'm getting 37331868 for A (expecting 1) what am i doing wrong ? Thank You
  11. Henry Olive

    Ord Funcition

    Thank you so much Kas, Uwe My problem solved.
  12. Henry Olive

    Ord Funcition

    Thank you so much Uwe, your code works but the result is not as my expectation //Edit1.Text = A Edit2.Text := IntToStr(Ord(Edit1.Text[1])); Result = 65, Expecting 1 //Edit1.Text = B Edit2.Text := IntToStr(Ord(Edit1.Text[1])); Result = 66, Expecting 2
  13. Henry Olive

    FloatToStr

    Good Day Delphi 10.4 When i convert to a Float to Str i'm having comma, dot problem like below ItemNo := Table1ITEMNO.asString; Qty := Table1QTY.asString; (Original Value is Float) SQLText := 'SELECT * FROM MyProcedure (ItemNo, Qty)'; I copy sql to clipboard & clipboardt shows Qty value as 11,25 (According to my Windows setting) but Firebird Database requires Qty value as 11.25 ( with a dot, not a comma ) How can i convert 11,25 to 11.20 ? Thank You
  14. Henry Olive

    FloatToStr

    Thank You Vandrovnik
  15. Good Day, Delphi 10.4 I created a grouping on ITEMNO and it's OnGetText event i wrote below code procedure TBomKitSubkit.CDS1ITEMNOGetText(Sender: TField; var Text: string; DisplayText: Boolean); begin if gbFirst in CDS1.GetGroupState (1) then Text := Sender.AsString else Text := ''; end; everthing works well. My Query result looks like below in a DBgrid ITEMNO..SUBITEMNO..QTY AA1...........XX1.......................1 XX2.......................2 XX3.......................1 AA2..........XX4.......................3 Is it possible get the result like below, (First SUBITEMNO not just right of of ITEMNO but 1 line bottom) ITEMNO..SUBITEMNO..QTY AA1 XX1...................1 XX2....................2 XX3....................1 AA2 XX4.......................3 Thank You
  16. Good Day, Table1 : ITEMCODE...LOCNO....LOCQTY...LOTNO(Str) X1.....................A1..............10...................12 X1.....................A2..............20...................13 X1.....................A3..............10...................14 X1.....................A4..............10...................15 X2.....................B1..............10...................23 X2.....................B2..............40...................24 X3.....................C1..............50...................25 X3.....................C2..............60...................26 Table2: ITEMCODE...QTY...LOCNO......LOTNO X1.....................50.....Empty.........Empty X2.....................50 X3.....................50 In summary i want to write Table2's LOCNO & LOTNO fields below datas Table2: ITEMCODE...QTY...LOCNO......................................................LOTNO X1.....................50.......A1=10, A2=20, A3=10, A4=10........12, 13, 14, 15 X2.....................50......B1=10, B2=40..........................................23, 24 X3.....................50......C1=50.........................................................25 I wrote some codes but I wasn't completely successful. while not Table2.Eof do begin Query1.SQL = Select * from Table1 where ItemNo = QuotedStr(Table2ItemNo.asString) while not Query1.Eof do begin if Query1.FieldByName('LOCQTY').asFloat >= Table2QTY.asFloat then begin LocNos := Query1.FieldByName('LOCNO').AsString + '=' + Query1.FieldByName('LOCQTY').asString; LotNos := Query1.FieldByName('LOTNO').AsString + '=' + Query1.FieldByName('LOTNO').asString; Table2.Edit; Table2LOCNO.asString := LocNos; Table2LOTNO.asString := LotNos; Table2.Post; end else if Query1.FieldByName('LOCQTY').asFloat < Table2QTY.asFloat then begin // MyProblem is here end; I'm so sorry i know the question is too long, but This is how I could explain it with my poor English Thank You 7 /
  17. Henry Olive

    While not CaLculating

    Remy, THANK YOU SO MUCH
  18. Henry Olive

    While not CaLculating

    Remy, Thank you SO SO SO much for the time you spent for me Your both codes works very well but I'm so sorry i couldnt express well my problem For example Query result like below for X1 Item ITEM..LOCNO...LOCQTY...LOTNO.. X1.........A1........... .4................01 X1.........A2.............6................02 if Table2QTY = 10 then LocNos:=A1=4, A2=6 LotNos:=01, 02 if Table2QTY = 2 then LocNos:=A1=2 (Even A1 LOCQTY = 4, because i'll pick just 2) LotNos:=01 I want to pick an Item from its Locations UPTO Table2QTY according to query result order When the result reachs to Table2QTY it must skip the other Locations Thank You
  19. Henry Olive

    String Grid Loop

    Good Day, I have a StringList like below (total 4 rows) ITEMCODE...QTY 01-01.............10 (This Row is Empty) 01-02.............30 aaa I'd like to get JUST correct ITEMCODEs (According to my ITEMS table records) For example in above grid Empty Row and aaa dont available in ITEMS table so i want to skip them I only need '01-01' and '01-02' My Code is like below for i := 0 to SGrid1RowCount-1 do begin ItemNoCol:=SpinEditItemNo.Value; ItemNo:=SGrid1.Cells[ItemNoCol,i+2]; SQLDataset.Close; SQLDataset.CommandText :='SELECT ITEMCODE FROM ITEMS WHERE ITEMCODE='+QuotedStr(ItemNo); SQLDataset.Open; if (ItemNo='') or (SQLDataset.Fields[0].asString='') then ........ // I need a code here like Skip the row and go to next row else ...... ......... end; Thank You
  20. How can i get First Business Day Of Next Month ? ( Saturday & Sunday are not Business days.) For example in February Next business day of next month is March-01 In May Next business day of next month is June-03 Thank You
  21. Henry Olive

    First Business Day Of Next Month ?

    Thank you so much Lars, Uwe You both are right, Is there a way to consider also local bank holidays ? Thank You
  22. Henry Olive

    Character Problem

    Good Day Delphi10, FB-3, SQLDataset, DataSetProvider, CDS, DataSource MasterTable TNAME Field.Value = 'A.Cap-' // There is - at the end When I insert a new record into the DetailTable my code is like below DetailTable.FieldByName('TNAME').asString := MasterTable.FieldByName('TNAME').asString; After Post & ApplyUpdate when i check releated record in the Database i see TNAME value in DetailTable is 'A.Cap' // No - at the end, There should have been 'A.Cap-' but in Database, MasterTable TNAME value = 'A.Cap-' // there is - at the end which is correct What is wrong ? Thank You
  23. Henry Olive

    Character Problem

    The problem is SOLVED The Field's size in SQLDataset was 5 (should have been 8 ) I change the Field's size to 8 and problem solved I'm really very very sorry i firstly should have checked that size property I apologize to everyone THANK YOU
  24. Henry Olive

    Pos, SplitString

    Good Day, MyString could be 'Aaaa Bbbb <Axx Bxx>' or just '<Axx Bxx>' In any case i'd like delete just the part of <Axx Bxx> (Including < and >) What is the shortest way ? Thank You
  25. Henry Olive

    PrinterIndex

    Good Day, I have 2 printers, before print any doc i may change my printer via PrintDialog with below codes i can print my docs w/o any problem but when i change the to my second printer ( not default) i get empty paper (no print) what am i doing wrong ? QrPreview1.QRPrinter.PrinterIndex:= Printer.PrinterIndex; QrPreview1.QRPrinter.Print; Thank You
×