551

(13 replies, posted in Reports)

Lee,
I took a look at your project mainly focusing on your database structure and the one report you had issues with and not so much with your data flow in your forms. Keep in mind when defining database tables that when you are creating related tables that you have your child tables pointing to parent tables. So in your project players table should be pointing to teams table and teams table should be pointing to league table and I think league table should be pointing to seasons table and for the most part you do have it that way. I am assuming that you have multiple leagues in a season. One mistake I see is that you have the League table pointing to teams and you have teams pointing back to league. And your League is not pointing to Seasons. So one correction would be to change the League relationship field from Id_Teams to Id-Seasons and then remove the id_league field from Seasons. Your Matches should be pointing to teams so remove the id_Matches from the Teams tables. I'm not sure what the purpose of the Teammates table is. Why can't you define all the team players and the team statistics in the Teams table. For that matter if you are only using the Players table to store the player's name, why can't you just store the player's name in the Teams table. I am assuming that you only have 2 or 4 players on a team. It seems like having the Teammates table is making it much more complicated than it should be. Your matches then would only need to point to teams and it's associated players. I did not change any of the structures in the attached project.

The next thing I looked at was your actual data in the tables using SQLiteStudio. I know this data is only test data, but none of your tables had any of the related fields filled in which tells me that your forms are not filling in this data properly which means your report won't work either. As far as your report is concerned, you defined each of your tables in script as separate datasets with no joining of the tables. I changed your print button in the attached project to REPORTSQL instead of using the script and defined the joining of related tables in the Select statement. The report definition was changed to incorporate the Group Headers for League and Teams. I manually filled in some of the missing related data so the report would work. Select the Tuesday Night league when viewing the report.

Like I said I did not look into how your forms are flowing the data. There could be other flaws, but maybe this can get you back on track with your project. I can't spend too much time either, but I'll try to help where I can. Maybe Derek can chime in since it seems he is more familiar with your project.

552

(11 replies, posted in SQL queries)

Just following up on this. In an effort to duplicate this situation using the previous example in this post, I discovered some more info on this situation. I'm not sure if there really is a problem. I actually think that the 2.6 version of MVD may have fixed something that shouldn't have worked before. Here is the situation that causes it not to work. In the object inspector for the DateTimePicker field used in the query, if you have the "DefaultChecked" property unchecked and you also have the "Visible" checkbox unchecked, then the query will not work. If either one of them are checked or both are checked, then the query works fine. Like I said, I'm not really sure there is a problem. I'll let Dimitry comment on that. All I had to do is go into all my projects that had this situation and check the "DefaultChecked" checkbox and everything was back to normal.

553

(11 replies, posted in SQL queries)

Thanks Derek,
This workaround does work and I'll use that approach for the time being. Hopefully Dimitry will fix this in a short order.

554

(11 replies, posted in SQL queries)

Dimitry, a little more info on this. The datetimepicker in the SELECT is hidden on the form. In other words the VISIBLE checkbox is unchecked. However, when I make it visible (checkbox checked), the query works. So when the datatimepicker is visible on the form, the query works. When it is hidden, it does not work. It brings back nothing. Hope this helps in solving this issue.

555

(11 replies, posted in SQL queries)

Dimitry,
Your solution to this query stopped working in 2.6. It works fine under 2.5.

556

(12 replies, posted in General)

Gieri,
To reset the id to 0 after deleting all records from a table, place the following after your sql delete:

SqlExecute('Delete from sqlite_sequence where name=''Table_Name''');

Substitute Table_Name with your table name inside the quotes.

557

(18 replies, posted in Reports)

It works now. A great big thank you Dimitry.

558

(18 replies, posted in Reports)

Dimitry,
The preview is now fixed. Thank you. However, lhimes is right. The designer still has a problem. It's actually worse now. For example, if you click on the open button to open a report in the designer, the open dialog appears behind the designer and you cannot bring it forward to select a report and it locks the project.

procedure Form1_Edit1_OnKeyDown (Sender: string; var Key: Word; Shift, Alt, Ctrl: boolean);
begin
    If Key = 13 then Form1.Button1.Click;    // The Button1 action is set to Show Form2
end;

However, you do not need to simulate the button click unless you have a reason to.,  You can just call the form  - see below
   If Key =13 then Form2.Show;

Try the attach. Is this what you are looking to do?

561

(6 replies, posted in General)

Using Jean's example you can do the following to reset the ID field in the EMPLOYEES table:
SqlExecute('Delete from sqlite_sequence where name=''Employees''');

562

(8 replies, posted in General)

If I may ask. Why are you loading the datetimepicker field with a SqlExecute rather than letting MVD handle it on a form automatically? Since you have a null date, a check for it should be put in place. I modified the Pozidis example in another post for your situation. See if the attached is acceptable.

563

(8 replies, posted in General)

Put your SqlExecute('Select.....' inside the parentheses of SQLDateTimeToDateTime( ). 

form1.DateTimePicker2.DateTime:= SQLDateTimeToDateTime(sqlexecute('select startdate from seasons where id=seasonname' ));

564

(6 replies, posted in General)

Not sure why you get an error. I don't.  If you are able to assign the SqlExecute value to a caption, you should be able to assign it to a string variable. Then breakdown the string variable with the copy function and concatenate the pieces in the order you want for the label.

565

(18 replies, posted in Reports)

Dimitry,
Any update on fixing this issue? It's rather important. Thanks.

566

(6 replies, posted in General)

Maybe the possible solution I presented to V Pozidis in the next topic could help you. Just change the edit.text to label.caption.

567

(6 replies, posted in General)

v_pozidis,
Attached is a possible solution using the method you are trying to do.

568

(6 replies, posted in General)

You can do the following:
String_Date := Formatdatetime('DD/MM/YYYY', Date);

569

(18 replies, posted in Reports)

Understandable. Just need to know if you are continuing with trying to resolve the issue? The reason I ask is that I can't go to production with my projects until this is resolved. Thanks.

570

(18 replies, posted in Reports)

I think I figured out the pattern to cause this situation. I tried your report examples and it does not happen, but all my projects it does. Here is the situation I think causes it. I like to use a blank maximized form as my first form so that all other forms are inside the same background. If I remove this form and start with a normal form, it does not occur. I have attached an example of what I do. Run the project and click on the print button. Then when the report preview displays, mouse over any of the buttons in the preview toolbar and the project form will pop up.

Perfect. Thank you Derek. Yes it definitely needs to be added as a property.

Is there a function or anyway to capitalize the first letter of each word in a text field? ie names and addresses.

573

(18 replies, posted in Reports)

Dimitry,
Maybe you can shed some light on this. Whenever I am in FastReport developing a report, on random occasions, mousing over random areas of FastReport the screen I just left from in my project pops up and overlays the Fast Report screen. I cannot close it or do anything with it. I have to bring up Windows Task Manager to switch it out and go back to the FastReport screen. It's just not one project that it occurs in. What's worse is that it also happens for end users in previewing reports. When you mouse over the Fast Report toolbar in preview, it will do it. Sometimes if you are fast enough you can click the toolbar button before the screen pops up to save or print a report. Any ideas on what could be causing this? It happens frequently and is rather annoying.  I am on Windows 7. FastReport is 4.15.

Not sure what you mean by "...with even", But you can place the following code in you button click script to simulate an On / Off switch. Obviously you would need to add other code to do something when it's ON and when it's OFF.

If Form1.Button1.Caption = 'On' then
        Form1.Button1.Caption := 'Off'
      else
        Form1.Button1.Caption := 'On';

575

(3 replies, posted in Script)

You are quite welcome. Glad to help.