FastReport4: Refresh Dataset - delphi

My Report.ShowPreparedReport didn't recognize a new addition to my frxDBDataset.
So, I was building 1 report using TfrxDBDataset linked to a TVirtualTable.
Previously only 10 fields stated in Report1.fr3 and it works well.
I do the SaveAs from Report1.fr3 to Report2.fr3 in designer mode
Get back to my Delphi and add 1 new field "tec" in my TVirtualTable
Go back again in ReportDesigner (file Report2.fr3) and see that my new "tec" field is listed in Data tree.
Add the "tec" field to the report.
Preview while on designer and it was normal.
Run the program and call to preview report, it says "field 'tec' cannot be found" or something like that.
Anyone got solution?
Thanks

Please Try.
TVirtualTable.Refresh;
frxDBDataset.FieldAliases.Clear;
When you clear aliases then call Designer
FastReport automatically updates aliases.
That was the perfect solution for me.

Related

TDBrichedit displays plain text rather than rich text

The context is that I am maintaining an application running on delphi 7 with the BDE. I programmatically assign dbricheditcontrols' datafields to allow users to edit rtf documents. When the relevant forms open, the unformatted text is displayed and then once say the person moves onto the next document, suddenly the rich text kicks in; I suspect it must be an initialisation problem of sorts, but what am I missing; could not locate a solution online.
Thanks
Ordinarily, I would not post an answer to a q which states
I programmatically assign dbricheditcontrols' datafields to allow users to edit rtf documents
but fails to include the code that you are using - you should have provided an MCVE (see https://stackoverflow.com/help/mcve).
However, what you say sugggests that you may be going about what you are trying to do the wrong way. You say you are using a TDBRichEdit component, but if you are using it correctly, it should not require any programmatic assignment of datafields to do it: you simply need to connect the component to the TTable or TQuery you are using via a TDataSource component, and configure the DBRichEdit to access whatever field of the TTable/TQuery that stores the richedit text. That can be done a design time using the Object Inspector in the IDE to set properties and does not require any code.
So, it seems to me that either you are not using the DBRichEdit correctly, or you are trying to do something that you have not explained in your q.
You can satisfy yourself that a DBRichEdit works automatically, without needing to load or save its contents in code, as follows:
Open the FishFacts demo
Add a TDBNavigator and a TDBRichEdit to the form. Set the DataField property of DBRichEdit1 to Notes.
Set the ReadOnly property of Table1 to False. Then set Table1's Active property to True.
Compile and run the project. While it's running
Start WordPad.Exe and create a bit of richtext in it. Copy it to the clipboard. Click the Save speedbutton of DBNavigator1.
Paste the richtext into DBRichEdit1.
You should find that you can navigate away from and back to the edited record and the richtext will be automatically reloaded.
Also, the following code works fine for me to load the Notes field from an .Rtf file
procedure TForm1.Button1Click(Sender: TObject);
begin
Table1.Edit;
TMemoField(Table1.FieldByName('Notes')).LoadFromFile('D:\test.rtf');
end;
and does not initially display the unformatted text as you describe. So I'm fairly sure you problem is arising in code of yours that you haven't shown us.
Btw, the only reason I am posting this as an "answer" is that there is more to say than will comfortably fit in a comment.

How to get data from two databases via FastReport

I have created a report using FastReport Designer (Delphi 2010). I have one TfrxIBXQuery (Query1) connected with main database -Base1(frxIBXComponents.DefaultDatabase:=Base1). It works fine, I can get data using Query1+MasterData band.
The problem arises when I'm trying to get data from another database in the same report.
In Designer I drop new frxIBXDatabase (Base2), set the necessary properties. Add new TfrxIBXQuery (Query2) and connect it with Base2.
But I can't get any data from Query2 because it does not see Base2.
How do I solve this problem?
When you look at the properties tab from your query component, can you see any FieldAliases?
If not, you should check the SQL, FastReport can be really picky when it comes to parameters.
Try changing parameter names and see if that works.
If you want to use two or more databases inside report - you should use two TfrxIBXDatabase inside report (on the Data tab)
Clear frxIBXComponents.DefaultDatabase property

Android - What does question mark signify in searchable.xml?

I'm debugging SearchableDictionary sample on android 4.0. In searchable.xml, what does question mark signify in this attribute, android:searchSuggestSelection=" ?"?
Here is the snippet :
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="#string/search_label"
android:hint="#string/search_hint"
android:searchSettingsDescription="#string/settings_description"
android:searchSuggestAuthority="com.example.android.searchabledict.DictionaryProvider"
android:searchSuggestIntentAction="android.intent.action.VIEW"
android:searchSuggestIntentData="content://com.example.android.searchabledict.DictionaryProvider/dictionary"
android:searchSuggestSelection=" ?"
android:searchSuggestThreshold="1"
android:includeInGlobalSearch="true"
>
Thanks.
It stands for the query typed by the user. See the docs
android:searchSuggestSelection [String]
This value is passed into your
query function as the selection parameter. Typically this is a WHERE
clause for your database, and should contain a single question mark,
which is a placeholder for the actual query string that has been typed
by the user (for example, "query=?").
Alternate
android:searchSuggestSelection="word MATCH ?"
also had a problem on this one, SearchableDictionary sample. cannot find the Resource folder because R.java is not generated which is probably the same problem you were experiencing that's why your debugging the XMLs. this is the solution that worked for me. link
Right-click on your project
Choose Properties
Choose Android in the left menu
Tick a box next to the appropriate Project Build Target.*****
Click Apply and OK
My additional instructions:
*****Choose build higher than API 10 or starting from API 11. If you choose lower than 11 you will still get the error. This worked for me. tried most of the suggestions ahead of this. finally solved it.

Rename work item type fails

In TFS2010/TFSPowerTools2010/Process Explorer I am creating a custom process template. I define a new work item type (WIT) called "Enhancement" copied from the CMMI "Change Request" WIT.
Then I want to rename the friendly field name of the work item type "System.Title" (called "Title") to "Summary".
When I upload my custom process template to the TFS server and create a team project, and then create a new Enhancement, the info in the required field text still shows :
"TF20012: Field "Title" cannot be empty.
Why ?
(I want to see "TF20012: Field "Summary" cannot be empty.)
What you can do is create a new field and make it required. Call it Summary, etc. Change the Title label and textbox from the stock values and point it to your new field. Do not remove the System.Title field from the field list.
In the work flow, use the Summary value to populate the System.Title field, which is not on the form. Then if they try to save without a Summary, they will get the correct error and System.Title will have a valid value for reporting.
Be sure you account for the System.Title field everywhere it is referenced in the work flow.
You aren't able to rename a system field like System.Title. It's used by other work item types across the team project collection and the server instance. It also has to be filled in by the default rules. You can rename the "label" that gets shown to the end user by going to the layout tab of the work item type editor (in the TFS Power Tools) and find the control and change it's label attribute but leave the field the same.
In Visual Studio I was looking at a WinForm and saving the form I got this error:
Microsoft Visual Studio Save failed.
TF20012: Field 'Title' cannot be empty.
OK
Since its a TF error I closed all the Work Items (even unsaved ones...) and then saving the Winform worked.
I am not sure how VS thought the Work Item was the active code window I saw looking at.

Delphi Search Edit Component

I need a delphi component for Delphi 2007 win32 that have features like Google search text box.
** While User writing search key it should fill/refresh the list with values, and user can select one of them.
**User can go up and down list and can select one of them.
**List should contain codes and text pair, so user can select text and I can get code for database operations.
(Google can highlight the search text in List but I think it is not possible with Delphi 2007, so it is not expected.)
I tried Dev Express TcxMRUEdit, however it doesn't meet my needs
Since you have DevExpress, why don't you try the cxLookupComboBox in lsEditMode and with ImmediateDropDown = True?
Check out woll2woll components. The TLookupcombobox has done this since Delphi 3 (or earlier). This is not spam, I just use the library.
http://www.woll2woll.com/
I also had the same problem and unfortunately didn't find a suitable component. I was also inspired from google.
So it turned out to be easier for me to "simulate a component" by using an editbox and a grid placed under it. As the user types something in the editbox the query refreshes and the proper resulst are shown in the grid. I have many columns in the grid, the query results try to match all the fields (so if I type 'po', the query will return all records where any field is like 'po%'). I also added a delay of 500ms after the user types to avoid to run too many unnecessary queries (another aproach could be to kill the thread as the user strikes a new key, if the query is run in a thread).
In this way I obtained the required functionality, even if without higlighting the search text, anyway my users are delighted by this.
In every place I am using this "component" I am attaching a query at runtime so it can be used in many different forms.
I somehow was also inspired by the skype UI: when you display the lsit of contacts you can type something and the contacts will be filtered accordingly (skype uses an editbox + grid/listbox).

Resources