Jump to content

Henry Olive

Members
  • Content Count

    288
  • Joined

  • Last visited

Community Reputation

5 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

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

    While not CaLculating

    Remy, THANK YOU SO MUCH
  3. 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
  4. 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 /
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. Henry Olive

    Round UpTo 1 Level up

    Thank you SO MUCH Uwe
  13. Good Day I want to round numbers 1 level UP, How can i do it ? If Value = 0,1 then Result= 1 If Value = 1,01 then Result= 2 If Value = 2,2 then Result= 3 If Value = 3,9 then Result= 4 If Value = 4,26 then Result= 5 etc Thank You
  14. Good Day, I need to find out if there is SUNDAY between 2 dates For example : StartDate = 06/23/2023 , EndDate = 06/26/2023 ( Result = 1 , Because 06/25/2023 = Sunday ) StartDate = 06/23/2023 , EndDate = 07/03/2023 ( Result = 2 , Because there are 2 Sundays ) StartDate = 06/23/2023 , EndDate = 06/24/2023 ( Result = 0 ) Thank You
  15. Good Day, How can i sort (descending) a table on a calculated field ? Thank You
×