emileverh
-
Content Count
76 -
Joined
-
Last visited
-
Days Won
2
Posts posted by emileverh
-
-
Team!
I have one large application which I compile twice, one is for MySQL and the other for SQLite. For regular queries like select * from everything goes fine. But it goes wrong with SUM() functions.
The query defined in a TFDQuery below works fine in MySQL, but when I compile the application for SQLite I get an exception "Type mismatch for field 'SumVal', expecting: FMTBcd actual: Float'. "
The definition of AmountValue in the database is: AmountValue DECIMAL(13,4) NOT NULL
And here is the query:
select SUM(AmountValue) AS SumVal
from camtentries
Is there a property for this one and only TFDQuery or for the field qrySumPositiveSumVal.AsCurrency where it compiles fine in both applications? I prefer not to set an overall property in the TFDConnection.
Thanks!!!
-Emile
-
4 hours ago, Remy Lebeau said:All of the major OAuth providers - Google, Microsoft, etc - should have full documentation about their workflows.
Correct! But... it's not an easy part of software to write!
-
39 minutes ago, Remy Lebeau said:Use the Win32 SHFileOperation() API to copy the file with the FOF_RENAMEONCOLLISION flag:
If you need to know what the copied filename was renamed to, include the FOF_WANTMAPPINGHANDLE flag as well:
Alternatively, on Windows Vista+, you can use the IFileOperation API instead, using IFileOperation.SetOperationFlags() to set the FOF_RENAMEONCOLLISION flag, IFileOperation.CopyItem() and IFileOperation.PerformOperations() to perform the copy, and if needed use an IFileOperationProgressSink event sink to discover the copied filename in the PostCopyItem event.
Thanks Remy for your help!!!
-
Just now, Remy Lebeau said:You cannot delete a file that is in use, unless the app that is using the file explicitly permits the deletion (by specifying FILE_SHARE_DELETE when opening the file). Nobody does that under normal usage, so you will need to detect when this condition happens (check GetLastError() when the deletion fails) and then. either 1) retry the deletion later or 2) ask Windows to delete the file on the next reboot (via MoveFileEx(MOVEFILE_DELAY_UNTIL_REBOOT)).
You are right force deleting a file is not a good idea. The other (unknown for me) process needs the file. Any idea if there is an API to add a kind of duplication number like: file (1).txt, file (2).txt, file (3).txt ?
I did Google something but I did not find 1-2-3 an API for that. Anybody knows?
-
17 minutes ago, Lajos Juhász said:You should check GetLastError to see the reason why it fails. https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-deletefile
One of the possible reason is that the file doesn't exists and the other is that the file is in use by other application.
Thanks and agree! I had to check if the file exists. But the DeleteFile() call was recently added. In previous versions of my app it failed on the next statement TFIle.Copy(). So again; is there a way to force delete a file?
-
Hi!
I need to copy a file to the Windows-temp folder. But on some of my clients it fails. I can not reproduce it, but when they open a mail with attachment in Outlook and my app is working on the same filename it fails. The routine below fails.
Please do not focus on Outlook, but in general. How can I 'force delete' a file? Or how can I safe save a file to the temp folder without problems? Any suggestions? Please help!
-Emile
function TdtmBoot.CopyFileToTempFolder(const AFullFileName: TFileName): string; begin var lFileName: string := ExtractFileName(AFullFileName); var lTempFolderFullFileName: string := GetTempFolder + lFileName; try if DeleteFile(lTempFolderFullFileName) = False then; // @17.22 begin SendMadBugReport(Self, 'CopyFileToTempFolder(), delete failed'); // <<<<<<<< HERE IT FAILS!!!!!!! end; except end; Result := lTempFolderFullFileName; try TFile.Copy(AFullFileName, lTempFolderFullFileName, true); // true = overwrite Result := lTempFolderFullFileName; except end; end;
-
8 hours ago, johnnydp said:Delphi suffers from lack of popularity and thus lack of adequate funding.
Too many things at once (mac, linux, mobile, fmx, vcl, c++ builder).
Ideally, it would be as if the company would choose some one way and focus all attention and power on it, increasing quality and performance.
Delphi needs:- Roadmap back!
- Make finally 64 bit IDE, compiler, linker etc. with total abandon of 32 bit(do not wasting time on 32 bit version and focus on one)
- performance (yes it matters all the time)
- Improve the quality and speed of bug patching (it's a little better than e.g. 5 years ago, but it's still outrageously slow comparing e.g. to VStudio, where we get some update, hotfix etc. every few weeks.- Realise that developers need quality much more than new features (they don't understand it for over 25 years)
Agree! Hotfixes and/or faster updates would be nice. Good quality goes above new features!
- 2
-
14 minutes ago, jeroenp said:The C# library Raptorious.Finance.Swift.Mt940 has been ported 5 years ago to .NET core at https://github.com/mjebrahimi/SharpMt940Lib.Core/tree/master
I have used the raptorious one to successfully parse ABN AMRO MT940 files and convert them to CD at https://github.com/jpluimers/MT940-to-CSV
It should be relatively straightforward to port them to Delphi.
--jeroen
Thanks!
-
On 5/27/2024 at 3:41 PM, Die Holländer said:Hello, I've sent you both a DM with a basic reader.
Can you send me the reader too? Thx!
-
15 hours ago, Lainkes said:I managed to loop with ControlCount.
First I disable all controls on my panel.
Then I enable my PageControl.
And as last I loop all mu controls on my PageControl and set them disabled.
// SET ALL COMPONENTS TO READONLY // Disable first all components for I := 0 to RzPanel1.ControlCount - 1 do RzPanel1.Controls[I].Enabled := False; // Enable TabSheets PageControl1.Enabled := True; // Disable components in PageControl for I := 0 to PageControl1.ControlCount - 1 do PageControl1.Controls[I].Enabled := False;
Thanks for the help and hints.
Alain
Use GetControls() new since Delphi 11 I believe. Just as an example for me to disable TcxEdit's only. But you can do your own stuff:
for var ctrl in frmMain.GetControls([ceftAll]) do begin if (ctrl is TcxEdit) then begin TcxEdit( ctrl).Enabled := false; end; end;
- 1
-
Great! Thanks a lot!!
-
Hi guys!
I am using D12. I have lots of code for ID’s like this:
type TProductID = record
ID : nativeint;
end;
What I want is this:
type TProductID = nativeint;
And yes I know the last declaration works! But when you make a call to a procedure and you mixed the params by mistake you got no error. Is there any helper, record attribute, compiler directive or so where I did not think of?!?!
procedure TForm6.FormCreate(Sender: TObject);
begin
var tmpid: TProductID := 6;
AddToStock(tmpid, 100);
AddToStock(100, tmpid); // I want a compiler warning or error here!!!!!!!
end;
procedure TForm6.AddToStock(pid: TProductID; cnt: nativeint); // Both uses internally nativeint
begin
ShowMessage(pid.ToString);
end;Now I have lot's(!) of database code like this in my program....
var cid : TCustomerID;
var pid: TProductID;
pid.ID := qryGetStockProductID.AsInteger;
cid.ID := qryGetStocCustID.AsInteger;
What I want is:
pid:= qryGetStockProductID.AsInteger;
cid := qryGetStocCustID.AsInteger;
-
@Angus and @FPiette, thank you both!!
-
Hi!
I installed ICS 9.1 today, wowww I am impressed. The demos are very impressive, compliments to the author(s) 😉 But also overwhelming with so much functionality.
Can you give me a direction where to look for with what is the easiest way to find a MySQL server ( with port 3306 open) on my LAN (192.168.x.x)?
Thanks in advance, Emile
-
49 minutes ago, Uwe Raabe said:There is a reason why that is not supported:
type TRecA = record; TRecB = record FieldA: TRecA; end; TRecA = record FieldB: TRecB; end;
I know it's a compiler problem, but why can they do it with classes and not with records....
-
53 minutes ago, Vandrovnik said:In forward declaration of a class, compiler immediatelly knows the size of that type. For records, their size would be unknown in forward declaration.
That can be true, but that is 'not my problem' how to solve it. I use records a lot for several reasons (speed, memory management,....). And it would be VERY nice to have that.
-
forward declaration of records, just like a class
-
Just now, PeterBelow said:All components that have the form as Owner (which includes all components dropped on the form in the IDE designer) are automatically destroyed when the form is destroyed. So your query components are destroyed but whether that automatically releases serverside resources depends on how the component, especially its destructor, is implemented. But a TFDQuery will close the query when it is destroyed, so your scenario is OK.
Thanks for the quick reply!! 😉
-
Just now, Tom Chamberlain said:Depends where the TFDConnection is defined, are you using a shared data module or creating it in the form? Is it pooled?
The TFDConnection is on a central place in the program on a different datamodule. ( MySQL and the property 'Pooled' is left default, which is False )
-
Hi team!
frmSelectFooter := TfrmSelectFooter.Create(self);
if frmSelectFooter.ShowModal = mrOk then
begin
...
end;
FreeAndNil( frmSelectFooter );
If there are TFDQuery's used in that form, do I need to close explicitly close the query? In other words, are (database) resources still in use?
Thanks!
Emile
-
11 hours ago, Fred Ahrens said:I don't need any new features.
I just need that the existing features work as intended. And there are many areas where existing features need to be made usable again (e.g. refactoring, code formatting, HighDPI).
OK, one new feature would be nice: compiling for Raspberry Pi. But fixing the existing features needs to be done first.
Totally agree. Fix the existing things first....
- 1
-
Looks interesting. I will try that! Thanks for your help ;-))
-
15 minutes ago, Pat Foley said:Outlook's contact info is a vcard file and calendar event is vcalendar *.vcs or *.ics file. The employee calendar shows the events provided by the calendars the employee has access to.
Example of email attachment
https://answers.microsoft.com/en-us/outlook_com/forum/all/how-to-insert-attachment-to-recurring-meetingYou would simply add an event attachment to the email of employee.
But better to educate the office staff how to use Outlook calendar by having the secretary set the events on the employee calendars as needed.
Employee leave requests are sent to office manager. If approved the secretary amends the department's calendar which updates the employee calendar.
The employee looks at the calendar events provided by the secretary. The secretary knows when the employee knows of a calendar event by the employee opening an email with a calendar event attachment and confirming the event.
Thanks for your answer. First the link does not work. And second my application is a planning tool where lots of mutations are done during the day. And adding email with attachments is not a good option ( we tought of that), because there will be a lots of mouse click work than and I don't want to run VBA scripts. Therefore I want full access to the local application, where the secretary has access to xxx employees. And I want to add/remove directly into Outlook. It already works for 1 calendar. But now I want to address one specific calendar.....that is my question
- 1
-
Yes, but it's loooooooots of things to read and every item is hyperlinked to another page. So I miss the overview. I hope(d) that some could say, yes I have done this before and do this (fake code): calendar.User[2].AddAppointment
Type mismatch for field 'SumVal', expecting: FMTBcd actual: Float'.
in Databases
Posted
Nice. But this is overwhelming, I don't see any practical info for me now....