576

(3 replies, posted in Script)

If all you want to do is set the focus in your comboboxes to the values from the frmShow textboxes, then attached is a possible solution. Hope it helps or at least maybe give you some other ideas.

577

(19 replies, posted in General)

I have found that Delphi Basics (http://www.delphibasics.co.uk/) is a good resource. You will also need to understand all the possible events which exist on all form objects in MVD. These events are where you will be placing your scripts. It looks like you will have a lot of calculations in your project. So for a simple form example, to add two numbers on your form and display the result on your form, a script could be as simple as

Form1.edit1.value := Form1.edit2.value + Form1.edit3.value;

You would typically place this script on your fields OnChange event. When you double click into an empty event in the Object Inspector Events tab, MVD will automatically put in the Procedure, Begin and End statements in the Script file for that particular event. You just place your code between the Begin and End statements.

You'll probably want to understand how to construct "If" statements for conditional processing and "ShowMessage" and "MessageDlg" for interacting with the user. Understanding basic SQL can help in certain situations. Since it looks like you will be totaling groups of records for averaging, you'll probably want to know how to do "SqlExecute('Select Total(Amt) from YourTable where....');"

I have only been around this product for about 5 months, including the 60 day trial. So I am by far not an expert, but I have been able to complete a fairly sophisticated project in that timeframe. Once you see how certain things work it becomes easy to repeat it for other situations. Of course, if you get stuck, you can always come back to this forum for specific problems or how to's. I am always amazed as to the help that is dedicated to it as you saw from Derek. Dimitry is the master. If it can be done, he'll have a solution. Hope this all helps. Good luck with your project.

578

(19 replies, posted in General)

I agree with Derek. I don't see anything popping out which would prevent you from completing your project. For your "s%" search, you may need to use SQL QUERY action to do that. I saw in your project where you defined totals, but I didn't see where you actually put in the calculations.

579

(19 replies, posted in General)

Derek's example is a good one. I went ahead and added the calculated fields that he mentioned so you can see the names of the other players in the tablegrid.

580

(19 replies, posted in General)

Not sure what exactly you are trying to do or what help you need. Do you have the relationship defined in your database between the two tables? If you do, then all you need to do is in the Object Inspector of the combobox on your player form (Team Table) you put in the foreign key entries to the Contact Table. Then make sure you include the combobox in the "Save" action of the form. There is no reason to place the Contact Name in the Team Table. It's really not good database design to have redundant data in multiple tables. Not knowing what your design is, maybe you do need to have the Contact Name in the Team Table. If so, you'll need to add some script.  Maybe you can be a little more specific in what exactly you need help with or what you're trying to accomplish.

581

(3 replies, posted in General)

hichame. Just curious, what software are you using on your Android Mobile?

582

(5 replies, posted in Script)

Awesome! Thanks Dimitry.

583

(5 replies, posted in Script)

Dimitry,
Is there an option in SelectDirectory that will allow the end user to create a directory within the same dialog box as the SelectDirectory, if the directory is not present? I have seen this in other Windows applications. Just wondering if you can do it here.

584

(11 replies, posted in SQL queries)

Thanks Dimitry. That worked.  Just curious. Any explanation as to why the way I had it worked in previous versions of MVD?

585

(11 replies, posted in SQL queries)

I put together a test project for you.

586

(11 replies, posted in SQL queries)

I may have come upon a bug in SQL Query Action. The following Sql works fine under 2.4 Beta, but not under 2.4 Release nor 2.5 Beta.

Select strftime('%m/%d/%Y',Due), Task, id
From Tasks where Due = {DateTimePicker1} Order By Due

It does not bring in the rows equal to the DateTimePicker. It has something to do with the equal condition. If I change the Sql Query to <= condition, it will bring in the less than rows, but not the equal rows.

587

(13 replies, posted in General)

Robb, thanks for that info. I'll give it a try.

588

(13 replies, posted in General)

Let me see if I understand how this all works. So if I use Robb's "Sqlite3.dll", the latest version of MVD, and place the Pragma Key code in my script, that this will encrypt my database and assign a password. Will 3rd party software such as SQLite Studio ask for a password to gain access to the database tables?

589

(1 replies, posted in Script)

Dimitry,
Is it possible to attach a MySQL database using the "Attach Database" command? If so, what is the syntax of the command?

590

(4 replies, posted in General)

Derek - Thank you for your workaround trickery. That was very ingenious on your part.

Dimitry - Thanks for your hack. Any plans to incorporate it in MVD?

591

(2 replies, posted in General)

Thank you Dimitry. That worked. Wasn't aware of "SelStart". Didn't see it in Delphi Basics. Thanks again.

592

(2 replies, posted in General)

I am doing a "Lines.Add" in a script to add text to the end of a memo (multiline) field. And then I set the focus to the memo field. However, the cursor(Insertion point) is sitting on the next line after what I just inserted in the memo field. Is there a way to set the cursor next to the text I just inserted rather than on the next line? Or can a keystroke be sent to the memo field to backup one space? Thank you.

593

(4 replies, posted in General)

Is there anyway to show datetimepicker fields as blank on forms when they are null? MVD always defaults to today's date even when it is unchecked. It's very confusing to people to see a date in there when it is suppose to be empty even though it is grayed out.  Also, I have not found a way to check for null dates on forms. In order to actually see if a date is null one has to do a SQLExecute and select the date field from the table. It just seems to be an extra unnecessary seek to the database to check for null dates. Please direct me in the right direction if I am wrong. Thank you.

594

(6 replies, posted in General)

Here is the website to Resource Hacker: http://angusj.com/resourcehacker/

I have used this and it works fine. In the menu options of the Resource Hacker software there is an item called "Actions". Click on that and then in the dropdown menu options there is an item called "Replace Icon: Follow the directions in the dialog box.  It's easy to do and it works. You can disregard everything else in the software, It's not needed.  Keep in mind that every time you create a new exe for your application you will need to run the Resource Hacker software to change the icon of your new application exe. Also, if you create a shortcut on your desktop for your application, you may need to go into the properties of the shortcut to apply the icon from your application. That's also easy to do.

595

(6 replies, posted in General)

If I am understanding you correctly, here is a snippet of code to do what you are looking to do:

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
     Form1.Memo1.Lines.SaveToFile('c:\text.txt');        //Memo1 would be your edit box or memo field
     OpenFile('c:\Program Files\YourProgram.exe');    //Run your program
end;

596

(12 replies, posted in Reports)

Wow, very good Dimitry. I had no idea you can do scripts within Fast Report. That certainly did the trick. Thank you for shedding light in that direction.  One thing that I noticed when messing around with it a little is that in order to show or use a value in the groupfooter it must be defined in the header. Am I correct in that assumption? The reason I say that is because I tried to define the value in the groupfooter and it does not work. It shows as zero. When I place it in the header then I can show it or calculate with it using a script in the groupfooter. Since I didn't want to show it in two places, I turned the visible property to false for the value in the header. However when the visible property is false, it does not show or work in calculations in the groupfooter. So what I did is changed the font to white for the value in the header to hide it. With doing that I can show the value in the groupfooter and I can use it in calculations (using a script of course). Don't know if that's what one is suppose to do, but it works for what I'm doing. Maybe there is a way to use variables instead.

597

(12 replies, posted in Reports)

Well Dimitry, your example works perfectly, but for the life of me I cannot see how it works. The expression you have for "Total with Discount" shows the following:
[SUM(

(<Report."cost">*<Report."countserv">) - ((<Report."cost">*<Report."countserv">) * <Report."discount"> / 100)

,MasterData1)]

What I don't understand is that nowhere in this expression does it mention the "Discount_flat", so how does the flat amount get subtracted when the report runs? I tested it and the flat amount does indeed get subtracted, but I don't see the actual expression which subtracts this flat amount. Help me understand. Thank you.

598

(12 replies, posted in Reports)

No, that's not what I am talking about. That's what you had in your example and for a discount rate that works fine. What I'm looking for is to subtract a flat discount amount for the client on the bill group footer, not a rate or percentage that gets calculated in the summation expression. This flat amount gets subtracted from the summation of the bill line items. It's not a subtraction on each line item. It's a subtraction of the line items sum. Hope this helps in explaining what I am looking for. I just do not know how to write the expression in the Fast Report syntax. Thank you Dimitry.

599

(12 replies, posted in Reports)

No. Just a total discount amount. And that amount should be subtracted from the total of the bill line items in the group footer.

600

(12 replies, posted in Reports)

Thank you Dimitry. I see how you calculated within the summation expression. Let me ask you this. Suppose the discount is an amount stored on the client record rather than a rate. How would you subtract the discount amount from the total sum of the bill line items?