Fastreport select fields to print - delphi

I have a report where I would like to select which field of database to show/print and hide all unselected field.I had seen in Fastreport demo but its only Choosing records to print. By the way i'm using dbexpress connection and firebird for database.
Any one who has some ideas about this?

Another simple solution would be to solve it on Delphi itself, before calling your Report.
Just add a calculated field to your dataset, and make it return the content of the real field that you want to show on your report. Now you can link your Report to that calculated field, and each time it will present the field that you have selected to present.

Related

Delphi - How to get a image for a cxGrid column?

I have a TcxGrid component to show data of a MS Access table. One of this columns have a picture. The column "Properties" of this column is marked as "ButtonEdit".
I don't want to use a BlobEdit. I want to create another form, for display this picture. It will be opened by OnButtonClick() event of the grid column. But, I don't know how to get the column content (as TStream or other type), or the column name/field name in the OnButtonClick() event. I can't fix the column name, because it's a "generic" grid for show any Access table.
How can I do it?
It will be nice to understand your question better if you can post your code. But offcourse You can get column contents easily by using FieldByName method. Try to use that.
You did not say how you load the data into the grid, but to get the cell content you can use:
VarAsType(cxGrid1TableView1.DataController.Values[cxGrid1TableView1.Controller.FocusedRecordIndex,cxGrid1TableView1.Controller.FocusedColumnIndex],varString)

RDLC report dynamic columns based on code

I have an MVC application which displays reports based on the report viewer.
Currently, the report has 4 columns and the requirement is to show columns based on the parameters selected.
I had achieved the solution by using sending parameters to the rdlc file and hiding the columns.
But now the problem which I am having is, when the report is exported as excel the last hidden column is showing as an empty column and this is an issue when printing the report from excel.
I would like to know if there is anything that can be done through code so that the column is not generated at all instead of hiding it. had done a lot of research but didnt find any solution. Can anyone please help me... Thanks!!!
One option would be to update the column's cell expressions to not return anything unless the parameter is set to show that column:
=iif(Parameters!HideColumnValue,Nothing,Fields.YourFieldName.Value)
If your column has background or line formatting that needs to not show when the column his hidden, you can set that as well:
Background Color:
=iif(Parameters!HideColumnValue,"White","Gainsboro")
Lines:
=iif(Parameters!HideColumnValue,"None","Solid")

Digital-Metaphors Report Builder string field size cache

I was wondering if anyone has a solution to this.
Lets say we have a varchar(10) field in a database table and this is included in hundreds of Report Builder reports.
Now if we increase the size of this field to now be a varchar(20) we have the problem where all data longer than 10 charaters will be truncated in the reports unless each report is physically edited by opening the data tab, removing the filed and reselecting it. Alternatively it can be done by opening the rtm file in a text editor and searching for the field.
Note that I am not talking about the physical display size of a field but the data field size.
Is there another way to make report builder reports somehow "refresh" the field sizes from the datasource?
thanks
Darren

How to display all data from 2 related tables in a dbgrid with sql

I'm new to delphi and have created an SQL query which displays the results of a search entered by the user through an edit box (showing data from 2 related tables) in a dbGrid.
The dbgrid displays no data until a search has been made and then the results of that search are displayed, however i was wondering whether it was possible to show all the related data in the dbgrid as if it were a table and the search then simply selects from it?
thanks
You could display all the data in the table. Then write an onExit event handler for your edit box which would look something like this (assuming that the string which you are entering in the edit box is supposed to match the value in the 'name' field of the query)
query.locate ('name', edit1.text, [loPartialValue]);
This will cause the dbgrid's cursor to jump to the first line which matches the string in the edit box.
Instead of using the OnExit event, you could also use the OnChange event of the edit box, but this would mean a search after every key stroke.
Your question was a bit vague so it's difficult to give a specific answer.

How to display and edit hyperlinks in DBGrid in Delphi 7?

I use DBGrid to display Hyperlink type field from Microsoft Access database (MDB).
Normally dbgrid displays hyperlink values like "(MEMO)", without editing capablity. Is there a way to solve this?
DBGrid displays values based on field type. If it shows (MEMO) then you probably declared your field in your database as TEXT or something equivalent. Can't remember Access, but in MS-SQL Server you can change field type to varchar and DBGrid will display values as editable text.

Resources