Preferably FastReport, but can be any that you know. I just ZConnection and ZQuery to work with the database. When I need to feed a grid with data from the database, do the power on hand, without using ClientDataSet. Does anyone know how I could feed a report without turning it into components database?
FastReport supports a wide variety of databases and datasources. You don't need to connect it to a TClientDataset to use it. From the wording of your question, it sounds like you need to make use of the TfrxUserDataset. This allows you to drive a report from any source (Listview, StringGrid, ObjectList etc).
You provide data via TfrxUserDataset's OnGetFieldValue event. You will also need to provide a RecordCount value and a OnCheckEOF event. As TLama pointed out, there are demonstration programs on how to do this in FastReport's Demos folder.
Related
trying to implement a query viewer in FMX Windows, which allows user to write a query and display its results.
the problem at hand is with fields of type Currency (or BCD, depending on the database), which is being rendered into the grid as "(BCD)" as shown below:
this question describes the exact same problem, specifically for FireDAC users. For the sake of trying, using FireDAC, the amounts in Currency fields are displaying correctly.
However, I am not using FireDAC. In fact, I am not using one specific set of DACs, as it varies with the underlying database in use.
I checked the options available in TBindSourceDB, the grid itself, but none would render the amounts correctly.
Any suggestions on solving this (other than converting the application to VCL and using a TDBGrid)?
Edit:
Delphi 10.3
DAC: TADSTable (Advantage), TEDBTable (ElevateDB) to name a few
MVCE: not much coding to share here, just drop 2 components, a TGrid and a data-access-component mentioned above (with a Currency field), link them up via visual livebindings and that's it.
came back to this problem after a few months, and managed to resolve it, so here's how it worked:
Removed the TGrid, and used a TStringGrid instead. Now the livebindings are able to render fields of type Currency without any extra manual configuration.
Somewhat lost here....
Using Delphi XE2 cross-platform (Win/OSX), I want to retrieve some XML through a call to a RESTful service, parse it, and then display selected elements in a scrollable grid control. In other words, I need to treat the incoming XML as a data packet and hook it up to a grid.
I am able to retrieve the XML at this point using a TidHTTP component and drop it into a memo control just to inspect it; all looks good. However, I don't understand the best way to wire this to a grid. When running in Firemonkey mode with OSX as a target platform, the grid types do not seem to include a data-aware one. I don't actually need a live connection to a datasource per se, as the grid contents will be read-only, so I am willing to manually populate the grid if I have to. What's the easiest way to ingest the XML and get it into my grid?
Probably dumb questions, but XE2 has so many web-oriented controls and technologies that I am just lost. Thanks!
You should convert the XML to an objectlist, then use LiveBindings to hook it up to a grid. It's a two step process. You'll find plenty of examples for each step.
An "almost" codeless way to do it is using XSLT and a TClientDataSet:
transform the incoming XML to a TClientDataSet-compatible XML data packet using XSL
load the XML data packet in a TClientDataSet
fill the grid by iterating over the rows and columns of the dataset
XSLT is kind of a swiss army knife for XML - it is a (XML-based) language used for the transformation of XML documents to other formats (HTML, plain text, PDF...).
The advantage of this solution is that no intermediary code (objects) have to be coded and instantiated - it is the shortcut to read the HTML response and convert to a dataset.
A quick search on the web found this example.
However I have not checked if XSLT is already available in Delphi for OSX.
I have an Stock program which developed by Delphi, I want a tools which can read the data from the stock program, for example, the stock price in Delphi grid object.
The Stock program under test is close source, so no chance modify source code which QTP/Robot inspector required. I cannot tell out which Delphi version it is using, neither the object is a standard delphi control.
So anyone can tell out is it possible to inspect that delphi program object data through other technology ?
thanks in advance.
You can use a tool like Winsight to find out the structure of the program window, and use FindWindow and EnumerateChildWindows to find the controls. Then you can use GetWindowText api to get the text of the control. This will work with most controls, but might not work for all. For instance TLabel control has no handle, but does its drawing itself. It has not handle to get the text from and it won't show up in WinSight. You'll have to OCR the window to get those label texts. :p
But this 'testing' sounds more like 'hacking' or 'controlling' to me, if you don't even know what kind of controls are used and which version of Delphi is used, why are you the one testing this program this way?
Trying to read data out of a Delphi grid control is not going to work out for you. It's not like a standard Windows edit control which you could just call GetWindowText on.
If you really want to get the information from this existing program then you'd need to poke at its internal memory or do an OCR on a screen grab. All pretty horrible to contemplate.
I have an OLE automation server (in fact, Open Office Calc) that doesn't close. Is there a way I can see what OLE objects are not freed? Truly, I think that because all the variables for this either go out of scope or are set to Unassigned, I shouldn't be having such a problem. as a precaution, I even set the ones (that I found) that go out of scope to Unassigned.
I have been careful to close Open Office Calc in the way prescribed by an example for this.
This might be somehow related to the presence of (embedded) pictures I've been adding to the Office document.
How can I find the cause of this?
I think this is now solved. I found that something about how pictures were being inserted was a "problem". I don't have a complete understanding of why it was a problem but it's enough that it works.
You probably need to display some example source in order to determine the problems you are having. However, you may also want to check out some example Delphi code found online to help accessing Open Office via Delphi: http://www.oooforum.org/forum/viewtopic.phtml?t=8878
I'm writing a DLL which talks to Excel via its IDispatch interface. From VBA I pass in a Variant containing Application.Caller from which I draw the IDispatch pointer via .pDispVal.
What I'd like to know is how to query the interface via that IDispatch pointer. I want to set up a connection point container, and from there find a connection point to Excel. The ultimate goal is to tie things to Excel's Calculate event and be able to manipulate the Excel data.
I would recommend Binh Ly's timelessly excellent (Delphi) COM tutorials at http://www.techvanguards.com/ which includes chapters entirely dedicated to IConnectionPoint and related mechanisms.
He also offers a free tool for generating EventSink code.
Still, I have a strong feeling that this shouldn't be necessary at all if all you want to do is react to an event triggered by the Excel Application object. Have you tried simply using the wrapper objects that the Delphi Type Library importer generates for you? You can of course also write your own wrappers.
Then again, I haven't actually written any addins for Excel yet - but I do write addins for Outlook and Word for a living and Excel really shouldn't be much different in this regard.
Brian Long explains: http://www.blong.com/Conferences/IConUK2000/DelphiMoreAutomation/More%20Automation%20In%20Delphi.htm#Events
Other resources:
http://dn.codegear.com/article/27126
http://www.gtro.com/delphi/comevents_e.php