526

(13 replies, posted in General)

Adam, I revised your last project to incorporate what I thought you wanted. But I see you entered another post which changed the design a little. See if you can use what I put together. If not, that's ok.

527

(11 replies, posted in General)

See if the attached works for you. I retrieved stamp from the user who logged in and replaced username with stamp in the report. I also increased the report text box to accommodate the stamp.

528

(9 replies, posted in General)

Adam,
Is it a requirement to have refunds in separate tables? A solution could be to incorporate your refund fields in the invoice and invoice items tables. You could still have a tablegrid of invoices filtered on refunds on a separate form, like you have, in order to show just your refunds. Just a thought.


You could do it in separate tables, but thinking off the top of my head I believe it could get a little involved. You would need to connect the refund tables to invoices by setting up relationships between them and then prepopulate the refund tables through script with invoice data upon a refund. And if the user cancels the refund, then you would need to delete the refund records. Also, for partial refunds, if a specific line item does not get refunded, it probably should be removed from the refund item table. As you can see, it can be a bit involved. Nothing is impossible though.

529

(5 replies, posted in Script)

Interesting concept Derek. I like it. Very creative and less script.


Thank you Dimitry for adding the method to the next version.

530

(5 replies, posted in Script)

Attached is a possible solution. Not sure if it will fit your scenario, but it's one way to accomplish what you are looking for.

531

(13 replies, posted in General)

Don't ever feel dumb. We've all been there and this forum is here to help each other. I'm still learning things with it myself. I'm glad you are understanding how parent-child relationships are done in MVD. As far as the CSV file import, what you described as to the process is exactly what the script I provided does. Download the attached project. It's the same as before except I commented all the relevant lines so you can see how the Id from the Clients table (parent) is loaded into the id_Clients field of the Calls table (child). The Calls table does not need the account number defined in it because the relationship is in place with the Id fields. Duplication of the account number is not necessary. The account number only needs to be defined in the Clients table.

Just so you understand generally the import process. Each line of the CSV file is read and loaded into variables. The account number in the CSV file is used to do a lookup into the Clients table and retrieve the Id field.  Script  - SqlExecute('Select Id From Clients where accountnumber = accountnumber from the CSV file....') This Id field from the Clients table is then used in the SQLExecute('Insert.....' ) to place into the id_Clients field of the Calls table. The rest of the variables are loaded into the Calls table with the same Sql Insert. Take a look at the commented script in the attached project and see if it makes more sense now. Hope It does.

532

(13 replies, posted in General)

I was about to reply to try to clarify things when I noticed Derek already did. I couldn't have said it any better. Thank you Derek. If I may add more info for Knobby. This may not be evident in the beginning for folks first learning MVD, but whenever you create a table in MVD, an auto increment unique primary key called "Id" is defined for you automatically in each table behind the scenes. If you have a parent-child relationship (linking 2 tables in your terminology), all you have to do in the child table (Calls in your case) is to define a relationship field and select the parent table (Clients in your case). MVD, as Derek mentioned, will define the relationship automatically for you. This is the Foreign Key. The field name is defined automatically for you as "id_parenttable" ("id_Clients" in your case).

If you go into the Database tab in either my project or Derek's project and click on the Database Schema button next to the New Table button, you will be presented with the Database schema which will show the primary keys "Id" in each table and the relationship between the Clients table and the Calls table. It really is an easy process in MVD and much simpler than with Alpha where you have to define and create "Sets" to do the same thing. As I mentioned before I am familiar with Alpha and even though you can set the relationships on other user fields, I never did or do. I always created the parent-child relationship sets using ID key fields, much like MVD does automatically. It's just good database design to do so.

Just to reiterate what Derek said, the only purpose for the script in my project was to populate the Calls table from the CSV file. Again, you do not need to manipulate your CSV file to import into MVD. Derek's example is a good one to show the relationships (linking of tables) without the confusion of the import script which obviously threw you off a bit. I apologize for that confusion and I surely hope I haven't confused you more.

533

(13 replies, posted in General)

Knobby, You do not need to manipulate your calls.csv file before importing. Download and run the attached project and use your MVD Test.csv file as the import file. No changes were made to your file. I did have to change the script slightly to accommodate your file, ie. skip the first line of your csv file because it was a heading line. I also had an error in the import counting. Once you do the import, click on each row of in the Clients tablegrid and you will see the calls for that selected client in the Calls tablegrid.

The Calls table does not need the accountnumber stored in there. However I used the accountnumber from the Calls.csv to lookup the accountnumber in the Clients table to retireve the primary key (Id) and insert that key into the Calls table (id_Clients) so you have a relationship between Clients and Calls. You do not define relationships in MVD based on user fields. Child tables store the related parent primary key (Id) rather than another parent field such as accountnumber in your case. I hope I didn't confuse you more.

534

(13 replies, posted in General)

Knobby,
I am familiar with Alpha 5. I have used it as well and still do on occasion. You are right that you can set relationships on any field in Alpha. However, I always used auto increment integers for primary keys, much like MVD does. It's really a better database design to do so. Having said this I used Mathias project and adjusted it to include the CSV import so you can see how it all works using MVD's relationship definition. There is nothing fancy with the code. The only error checking I did was to check to see if there is no matching account number in the CLIENTS table. Errors are imported into an Error table so you can see which calls were not imported. Hope this helps.

535

(1 replies, posted in Script)

What is the command to remove a directory (folder)? I looked on Delphi Basics and found RemoveDir and RmDir, but neither one works. I get the following error. Undeclared identifier: 'RmDir'

536

(10 replies, posted in General)

Lee, In Dimitry's defense, MVD is a RAD tool to quickly put together a basic application without doing any coding. You really can do that. I have done it myself. However, from my memory of your project, you are trying to develop a rather complex application with a unique design for your first project. There is no tool out there that can create an application design of this nature without some sort of coding or scripting. If you had to develop an application from scratch using the C programming language, you would  be coming back to MVD in a heartbeat. Having said all this, if a person has some experience in application and SQL database design and with some skills in programming, you can create some rather complex applications with MVD. I knew nothing about Pascal when I started with MVD a year ago, but I have experience in other programming languages which helped in learning it. Since you feel you do not want to learn another development language, I suggest that you reach out to this forum to see if anybody would develop the project you want. You may have to pay for it, but you'll get what you want. Somebody with MVD experience could possibly develop it in a rather short time frame. Maybe Derek could help you put it together, if he has time, since he is somewhat familiar with your project already.

Don't be upset with Dimitry. What he says on the website is not false advertising.

537

(6 replies, posted in General)

Adam, I can see where this could get quite involved and not a matter of throwing together a couple of script lines. There are still design questions that still need to be answered. For instance, when you open the app and you have 10 tasks due, should 10 ShowMessages pop up, which could be quite annoying to the user or display a tablegrid with tasks due. As much as I would like to help, regrettably I really do not have the time to build a full blown task management system for you. I can work on it a little at a time, but maybe somebody else on the forum can build it for you quicker. My apologies.

538

(6 replies, posted in General)

Adam, I think you need to be more specific as to what you want to be done with the recurring and reminder alarms. How is the alarm to function and where in the project is it to take place. Define the criteria in showing alarm notifications and inserting recurring alarms.

I found in the forum this post from Dimitry. See if this works.

OpenFile('params','x.exe');

540

(7 replies, posted in Script)

Hopefully I am understanding your question. You cannot import an Excel file directly. However you can save your Excel file as "CSV" format and import into MVD. If you are only importing one time, you may consider using something like Sqllite Studio to do the import. If it will be an ongoing import, then you can use the script from the following post example to do your import within your project. 


[http://myvisualdatabase.com/forum/viewt … 806#p14806]

541

(6 replies, posted in General)

The combobox on form1 is fixed. I'm not sure what you are looking for on the alarm and repeating part, so I did not touch anything with that.

542

(20 replies, posted in General)

You forgot to put in "UpdateDatabase('category');"  in your form1_button3_onafterclick.

543

(20 replies, posted in General)

Project fixed. The "category" tablegrid needed to be sorted on record_count. In your "category" move button SqlExecute scripts you were pointing to table "component" instead of "category".

544

(3 replies, posted in General)

Attached is how I would do it.

545

(8 replies, posted in General)

Just to add to Derek's solution regarding drawing lines, you can also use images to create lines. You can create an image (solid or gradient) outside of MVD with any image editor and insert it into your MVD project forms. It does not matter what the size of the image is. You can use the same image for all your lines in all forms if you want. You can stretch the line as wide as you want and make it as thin or thick as you want.  I used Derek's example attached and added image lines at the bottom of fieldform to create a box. I have a gradient image inside the box that can be used as separators / headers also. Both images are in the image folder within the project folder. No one way is better than the other. Just giving you options.

546

(20 replies, posted in General)

I added the multi-select to Dimitry's solution.

547

(20 replies, posted in General)

I used Derek's sample and put in the second part (Moving up and down). Hope this is what you are looking for. I added a counter field to your Country table to do this process.

548

(12 replies, posted in General)

Forgiveness is not necessary. It's understandable. You're designing and developing simultaneously while learning MVD. That can be challenging. I did change the approach of instant calc based on your request for calculating on entry into the Ending Balance (Edit2). As I said before I do not particularly like that approach because it can be problematic down the road depending on how you use the process in your larger project. It can be dangerous to only fire off a calculation on only one of multiple fields involved in a calculation. If a user changes data in a non-firing field, then no calculation will be performed. Anyway, enough of that. I think you get the picture. The attached is a hybrid of what I had before (and Derek too). It goes back to instant calc with a validity check on the starting balance. Very simple. MVD is pretty flexible in that you can create multiple approaches to tackle various situations.

I am curious though in what the logic is in your Starting Balance and Ending Balance calculation. Unless mathematics has changed since I've been in school, in order to get the difference between a starting balance and ending balance you must subtract the starting from the ending. In your examples 1, 2, 5, and 6 you in fact do subtract the starting from the ending. However, for 3 and 4 you add the two. Does the starting balance take on a new definition when it is negative versus positive. To me a starting balance is a starting balance regardless if it is negative or positive. Just curious.

549

(12 replies, posted in General)

Adam,
The calculation is correct. Edit 1 is the Starting Balance and Edit2 is the Ending Balance. If you started with 50 and ended with a -100, then you have a loss of 150. In other words you lost your original 50 and then you lost another 100 to get to a negative 100.

I updated the example with what you want to do with the firing of the calculation and the validation of the fields. I personally do not like doing it this way, but not knowing your project and what the intentions are, I made the adjustments for you.

Hope it helps.

550

(12 replies, posted in General)

Here you go. Since the Profit/Loss field is Read Only I also turned off the tab stop.