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.
Related
I am using Delphi 10 Seattle, FireDac, Oracle Database and the TMS Components.
I am looking for a method that allows me to load data from my dataset/query and put it on a StringGrid on demand. I think the correct expression would be paging.
When i have a huge number of records (5000+) my application is freezing (~5s) till it loads all of them in the grid.
I've read the wiki post from Embarcadero about Fetching Rows but i didn't find a solution there.
I tried different combinations of the TFDQuery FetchOptions and ResourceOptions but without luck.
I noticed that the SQLDeveloper by Oracle performs exactly how i want my application to behave.
I've recorded this short clip to demonstrate how the SQLDeveloper loads massive amounds of records:
https://gfycat.com/BlankOrganicIndianpalmsquirrel
It first loads 50 records and as I scroll through the grid the other records get loaded.
So the question is how can i get the same polling technique like SQLDeveloper.
Thanks!
EDIT: Was using LiveBindings. Switched to db-aware components and it looks fast as lightning now.
As mentioned in the comments i gained a huge performance speed by switching from LiveBindings to the DB-aware component DBGrid.
For smooth scrolling i used this SO answer:
Delphi dbgrid continuous scrolling
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.
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 need to improve a screen in our Application that presents an HMI (Human Machine Interface) display embedded in our Delphi code. This screen provides our customer with the ability to perform a range of actions (run test, product report etc) and to expose and view key named data values. This customisation is required because our Application controls machinery that might be operated by a range of skill levels from simple operator (may not speak English and must have very limited control) through to a power user who wishes to 'see everything' and have max control.
Some years back I created a solution based on an embedded HTML viewer (Turbopower's as it was then) and TPageProducer to dynamically tweak an HTML template (that the user could customise) and which would display a simple set of controls and data tables. This works fine but is slow to edit (you have to tweak the template and look-see the effect) and I'm sure there are better ways now.
What I need is similiar to a Delphi form that can be customised at runtime. I need: buttons, labels and edits. Editable shapes and arrows are desireable as are fixed images over which controls and text can be laid. The layout should be saveable (like a DFM file) and text labels should be of two types - fixed text and those which update to display key values on an update notification (like a DB control would). The final layout should zoom its scale to fit a resizable layout.
This question is about the best tool for the job and I'm not coming into this totally cold, I've experimented with Greatis Form Designer and obtained a working solution but before I commit, I would apprecaite comments about whether a report tool (with built-in report editor) would be possible / useable / better since a print dump feature would also be useful. (Fast Reports? Quick Report etc?). Note though that this is a display requirement primarily. Comments re newer embedded HTML solutions would also be welcome as would anything to ensure max future-proofing of the layout format.
Any solution should be useable in Dephi 7 (for now!) and does not need to be unicode as long as there is a migration path to this for newer Delphi's.
Any other comments or observations would be very welcome. Thanks.
Have you looked first at the free JVCL stuff? There's a JvInspector (RTTI component property inspector, just like Delphi property inspector), and a form designer, and so on. You could roll your own solution based on these, and even use JvInterpreter for some scripting capability.
Secondly, if you can support ANY control that you have, in your designer, and you need some HMI specific stuff, check out IOCOMP: http://www.iocomp.com/
TMS Scripter Studio Pro provides a Delphi-like IDE and form designer with scripting, but it maybe overkill for your requirements.
I have created a DBGrid in Delphi 6 and tied it to a DataSource contained in a DataModule. The Dataset for that source in also located in the same module. In the OnShow event for the form, I activate the dataset and set a label equal to the rowcount for the dataset. This shows several hundred rows but nothing shows in the dbgrid. If I activate the dataset in the IDE, the grid populates with the expected data. Does anyone have any idea why this behaviour would change between the IDE and normal runtime? We are also using SDAC connection components.
All 3rd party component choices are not mine to change.
I can elaborate as necessary for clarification, but I mainly need troubleshooting ideas to start at.
I have observed many times in D6 that the data controls can lose their settings at runtime, particularly the ones that associate one control with another. You might like to try setting the relevant names explicitly in your OnShow code before activating the data source.
I haven't been working with delphi for a few years, but I remember that the datasource property sometimes get lost if the dataset is kept active = true in design time.