-
Content Count
1406 -
Joined
-
Last visited
-
Days Won
22
Everything posted by programmerdelphi2k
-
IsValidDate fails after the Year 9999
programmerdelphi2k replied to Nigel Thomas's topic in RTL and Delphi Object Pascal
Independent of the System.DateUtils functions, I have tested the minimum and maximum value accepted by Delphi to inform a valid date and time, being: Delphi: of course, all should knows it Min: 30/12/1899 12:00 AM Max: 31/12/9999 23:59:59.999 TDateTime var using a "double" value directly Min: 01/01/0001 00:00:00.001 = -693593.00000001 = 693,593 days = 1900 years Max: 12/31/65535 23:59:59.990 = +669528949.999999940 = 23,920,275 days = 65,535 years Total: 24,613,868 days = 67,435 years then, the limitation is just from Delphi procedure! using TDatePicker (MSWin10 component) = Min: 01/01/0001 Max: 12/31/9999 = 64bits using TDateTimePicker = Min: 01/01/1601 Max: 12/31/9999 = 32bits NOTE: in function to Date/time, Delphi use "look" just first 4 digits for "years", then, the year "65535" stay as "6553"! here is the limitation! -
Have you tried using the "Revert to Default..." option to update the references to the "JAR" files used in RAD11.2?
-
Read this at first: https://developer.android.com/training/data-storage/manage-all-files https://developer.android.com/reference/android/Manifest.permission#READ_EXTERNAL_STORAGE https://developer.android.com/reference/android/Manifest.permission#WRITE_EXTERNAL_STORAGE https://docwiki.embarcadero.com/RADStudio/Sydney/en/Uses_Permissions https://docwiki.embarcadero.com/RADStudio/Sydney/en/Standard_RTL_Path_Functions_across_the_Supported_Target_Platforms https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Zip.TZipFile ( not so good, but it's enough)
-
first read this: https://developer.android.com/training/sharing/receive This demo shows interaction between Android applications using intents. It consists of two applications, SendIntent that creates and send the intent, and ReceiveIntent that receives the intent and displays the information. https://docwiki.embarcadero.com/CodeExamples/Sydney/en/FMX.Android_Intents_Sample
-
Transfer variable or fixed tekst to FastReport
programmerdelphi2k replied to CRO_Tomislav's topic in VCL
try this: implementation {$R *.dfm} uses System.DateUtils; procedure TForm1.Button1Click(Sender: TObject); begin frxReport1.Variables['MyVar1'] := QuotedStr(DayOf(Now).ToString); frxReport1.Variables['MyVar2'] := QuotedStr(MonthOf(Now).ToString); frxReport1.Variables['MyVar3'] := QuotedStr(YearOf(Now).ToString); frxReport1.Variables['MyVar4'] := QuotedStr(Now.ToString); frxReport1.PrepareReport; frxReport1.ShowReport; end; end. -
look in "RAD" demos folder <<Demos folder>> ... \Object Pascal\Mobile Snippets (camera and ShareSheet demos...) https://en.delphipraxis.net/topic/4206-send-email-from-android-with-multiple-cc-addresses/
-
see this
-
why you needs 2 "Application.ProcessMessages" ? procedure TForm1.Button1Click(Sender: TObject); var LIdSNTP: TIdSNTP; begin LIdSNTP := TIdSNTP.Create(nil); try LIdSNTP.Host := 'pool.ntp.br'; Label1.Caption := DateTimeToStr(LIdSNTP.DateTime); // working! finally LIdSNTP.Free; end; end;
-
what your choice? one for you, one for me!
-
@weirdo12 that's weird not? I think that you can be wrong about needs or not "IndexFieldNames" usage! WHERE IS the "IndexFieldname" ? really I dont need it!!! CUSTNO is PrimaryKey and ForeignKey on tables! NOTE: when you set a "index", your masterfield will be defined too! GROUP BY is not necessary (and dont have usage here because just 1 record will be the recordset) in Query3 (Detail) because "SUM()"+ param used in Query2 (Master) NOTE2: the other values "1221" was defined by FireDAC (It likes this) ... I just only put it in my Query1 on SQL! object EmployeeConnection: TFDConnection Params.Strings = ( 'ConnectionDef=EMPLOYEE') Connected = True LoginPrompt = False end object CustomerTable: TFDQuery Active = True Connection = EmployeeConnection SQL.Strings = ( 'SELECT * FROM CUSTOMER where custno=1221') /// just 1221 for tests or dont use this "where" clause for all!!! end object OrdersTable: TFDQuery Active = True MasterSource = DataSource1 MasterFields = 'CUSTNO' Connection = EmployeeConnection FetchOptions.AssignedValues = [evCache] FetchOptions.Cache = [fiBlobs, fiMeta] SQL.Strings = ( 'SELECT * FROM ORDERS' 'where custno = :custno') ParamData = < item Name = 'CUSTNO' DataType = ftFloat ParamType = ptInput Value = 1221.000000000000000000 // defined by FireDAC end> end object DataSource1: TDataSource DataSet = CustomerTable end object DataSource2: TDataSource DataSet = OrdersTable end object DataSource3: TDataSource DataSet = FDQuery1 end object FDQuery1: TFDQuery Active = True MasterSource = DataSource2 MasterFields = 'CUSTNO' DetailFields = 'CUSTNO' Connection = EmployeeConnection FetchOptions.AssignedValues = [evCache] FetchOptions.Cache = [fiBlobs, fiMeta] SQL.Strings = ( 'SELECT sum(amountpaid) FROM ORDERS' 'where custno = :custno') ParamData = < item Name = 'CUSTNO' DataType = ftFloat Precision = 16 ParamType = ptInput Value = 1221.000000000000000000 // defined by FireDAC end> end
-
Failed deferred Getit packages
programmerdelphi2k replied to Andrew Spencer's topic in Delphi IDE and APIs
have you tryed look at "Registry" key and delete the item about package that failed / and on GetIt repository folder NOTE: Embarcadero is a "hacker" and you need use "manual command line" List-in-Box dialog -
@CRO_Tomislav as I said before, the Master-Details would be your choice for this task, no needs more than this! example using "EMPLOYEE.GDB" in Interbase: Query1 (Customer - your item Names) : SELECT * FROM CUSTOMER // where CUSTNO = :CUSTNO Query2 (Orders - where is the items to sum): SELECT * FROM ORDERS where CUSTNO=:CUSTNO MasterSource = dsCustomer - MasterField = CUSTNO Query3 (Orders - the sum): SELECT sum(AMOUNTPAID) as TOTAL from ORDERS where CUSTNO = :CUSTNO MasterSource = dsOrders - MasterField = CUSTNO " :CUSTNO ": is a param (any name) used to inform the value that you need in "Query1", you can inform the param (if you want 1 item) or not (if you want all item) in "Query2 and Query3" you need use it
-
Anyone who has 1.5mi employees to pay would certainly not be here asking any questions! I preferred to use the old Master-Details, and that's it! would solve! About the "+0.00" (NOT is not for ISNULL checks) is because FireDac likes to determine data types, so I didn't want to do any checks in the component, to show 8 values on the screen... if you want, do it!
-
Create action for different components
programmerdelphi2k replied to Lainkes's topic in Algorithms, Data Structures and Class Design
@Lainkes you can try some like this, using a "container" to avoid many search for controls... ... private procedure MyCheckBoxOnClick(Sender: TObject); ... implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin for var i: integer := 0 to (ComponentCount - 1) do if (Components[i] is TCheckBox) then TCheckBox(Components[i]).OnClick := MyCheckBoxOnClick; // all checkbox with new OnClick... end; procedure TForm1.MyCheckBoxOnClick(Sender: TObject); var MyParent: TPanel; begin MyParent := TPanel(TCheckBox(Sender).Parent); // TPanel1,2,3 // for var i: integer := 0 to (MyParent.ControlCount - 1) do if (MyParent.Controls[i] is TWinControl) and not(MyParent.Controls[i] = Sender) then TWinControl(MyParent.Controls[i]).Enabled := not TCheckBox(Sender).Checked; end; -
@Stano in fact, it's not necessary have same structure, but the same type, if one table dont have any field (for example), you can use a "hack" for it!
-
with Roots as( select S.id, S.id_employee, S.Value, S.id_employee MyID_Root from Salary S join Employees on (Employees.id = S.id_employee) ), Datas as ( select A.id, A.id_employee, A.Value from Salary A join Employees on (Employees.id = A.id_employee) ) select B.id_employee, B.value, sum(B.value)+0.00 Total from salary B join Roots on (Roots.id = B.id_employee) join Datas on (Datas.id = B.id_employee) group by B.id_employee
-
ok, understand you needs a master-detail!
-
hi @CRO_Tomislav in fact, exists many ways to do it... you can use this simple SQL statement. select id_employee, employees.name, sum(value) from salary join employees on (salary.id_employee = employees.id) group by id_employee order by id_employee // or order by emplyees.name if you needs just show on screen you can use "FDLocalSQL" with "SQLite" engine to compute your final sql, like this:
-
in Form1.OnKeyDown() the "TAB" it's not captured because that is used for "jump" to another control = focus! but in Form1.OnKeyUP() you can see it... of course, it's too late for process as you want! {$R *.dfm} procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if (Key = VK_TAB) then // and (ssShift in Shift) then Memo1.Lines.Add('Form1.OnKeyDown:' + chr(VK_TAB) + ' TAB was pressed'); end; procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char); begin if (Key = Char(VK_TAB)) then Memo1.Lines.Add('Form1.OnKeyPress:' + chr(VK_TAB) + ' TAB was pressed'); end; procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); begin if (Key = VK_TAB) then // and (ssShift in Shift) then Memo1.Lines.Add('Form1.OnKeyUp:' + chr(VK_TAB) + ' TAB was pressed'); end;
-
From what I see, you want to change the behavior of the event, assigning new values within it, to change its trajectory. So, if he changes behavior within himself, wouldn't that cause internal confusion? Event: I got "A", and now you want it to be "B"... What do I do then? Therefore, I think it would be better if you make the change outside the event. And using a function like Keyb_Event() (outside the event), would be something more sensible! REMEMBER: the event can be called many times... in case, OnKeyDown is called as many times as the keys pressed!
-
thank you @Stano, after all, disagreements have always existed, however, we must not let them create distances between us. 🙏
-
great Melander... better than pointing to infinity, is showing where it probably starts. that way we can fix the path at any time! (better than being left in doubt by inconclusive answers)
-
maybe some like this would better: IsTrue := ((a + b)=1) and (c = d); if IsTrue then ...
-
if was possible, what would be better? or
-
Need a "Delphi programming guideline"
programmerdelphi2k replied to TheOnlyOne's topic in General Help
take care about your comments here... who knows who can see it? ... a robot, a BOSS... your ex 👨🏭👨🏭👨🏭👩🎨