151

(26 replies, posted in General)

unforgettable,
The solution I provided is based on the project posted on the forum. It sounds like what is happening is that your real project is setup differently and my solution is not going to work. It would be better if you just posted your real project so we can see how your design is defined and can properly help you. You can remove any real data from the database.

Anakin,
Are you asking how to change the trial date after your program is initially run and the trial date has already been set in the registry? If so, then one way to reset the trial is to delete the entry in the registry and rerun your program. But you do not want to share that with an end user or else they will reset the trial on a permanent basis. Another way is to write a separate program which all it does is set the date in the registry.

CDB,
Not sure what is happening on your end, but I checked it out and it works fine on this end. I tried on version 6.2, 6.3 and 6.4 and retrieving the record on the OnCellClick event works, Maybe attach your project and we can take a look.

154

(4 replies, posted in Script)

CDB,
For future reference the SQL INSERT does not have a WHERE clause. You can override the autoincrement id as follows:

sqlexecute('INSERT INTO productSupplier (id,supplier_part_number) VALUES ('+IntToStr(dbid) +',"'+frmMain.edtSupplierCode.text+'")');

sdhale29,
If both "My Program" and "Backups" directories do not exist then do your create one at a time.

CreateDir(GetEnvironmentVariable('USERPROFILE')+'\Documents\My Program');
CreateDir(GetEnvironmentVariable('USERPROFILE')+'\Documents\My Program\Backups');

156

(26 replies, posted in General)

unforgettable,
I had to make some assumptions in creating an Income Statement for you. Typically an Income Statement is a summary of expense and revenue categories so that is what I put together for you. I created a table of categories so that when you enter the detailed sales and expenses you assign it to a category. The Income Statement then summarizes by category and displays it on the form. There is a print button to view the report. In order to bring in the two transaction tables (sales and expenses) into the report I created a single summary table and populate it each time you run the report. I modified Derek's sales and expense forms to include a date range (period) search and to include categories. There is also a categories button to maintain the categories of income and expenses.

157

(26 replies, posted in General)

unforgettable,
I am somewhat confused and with me that is easy enough to do (LOL). I am not understanding your form flow and what your transactions really are. Your Income Statement form is setup like a data entry form. That probably is not your intention. First, it is not a good idea to have hardcoded expenses and income on a form unless you know for a fact that you will never need to have additional expenses or sales income in your app otherwise you will always need to be updating your app with any new expenses and sales income. It is just not good design. So you should display them as rows of data in tablegrids, which I believe Derek already has done for you. However, let me ask you this to understand your Income Statement a little better, are the expenses and sales income you stated suppose to be categories of expenses and income transactions or are they the actual transactions that get entered and then summarized by period? In other words, when you enter your sales transactions in Derek's form, do you enter in BOOKS, PENS, etc or do you enter something more detail like BLUE PENS, RED PENS, etc and then summarize by a category called PENS. Also, what happened to the depts. I thought you had multiple depts to track sales and expenses.

158

(6 replies, posted in General)

blackpearl8534,
Try this


procedure Form1_Barcode_OnChange (Sender: TObject);
begin
  Form1.ComboBox1.dbItemID := SqlExecute('Select id From Items Where itemBarcode = "' + Form1.Barcode.Text + '"');
end;

159

(6 replies, posted in General)

blackpearl8534,
In FastReport click on Report in MenuBar, then click on Data, then select your reports. See attached illustration.

160

(6 replies, posted in General)

blackpearl8534,
Check the attached.

161

(16 replies, posted in General)

CDB,
Thanks for updating the script for 6.3 and 6.4 users.

162

(16 replies, posted in General)

CDB,
Just letting you know that I am currently running version 6.2 and "Application.User.Username" is not recognized so it must have been introduced either in 6.3 or 6.4. Anybody who is on 6.2 or below must use "User.Username".

163

(16 replies, posted in General)

v_pozidis,
I went ahead and modified Dimitry's multiuser with locks project to include the new login and user roles feature of MVD (Requires version 6). See attached. You can test it on the same computer. You do not need to place it on OneDrive to test. Run the project and login as Admin (password is "admin"). Move the startup form to the left side of your screen. Then click on the ADMIN button. This form shows who is logged on and the record locks. The only thing that is displayed at this point is your login in the top tablegrid.

Now run the project again in parallel. Login as User1 (password is "user"). Move the startup form next to the Admin form. You will notice that User1 shows up in the Admin form top tablegrid.

Now run the project  a third time. This time login as User2 (password is "user"). Move the startup form next to User1 form. You will see User2 is logged in on the Admin form.

Double click on John Smith on User1's form. You will see that John Smith on User2's tablegrid turns red meaning that it is locked to other users. The Admin form will show the locked record in the bottom tablegrid. Double click on John Smith in the tablegrid of User2 (in red). An error message is displayed indicating that the record is locked and to try later.  All tablegrids update automatically as people lock and unlock records. You will need to place these lock mechanisms for all your tables in your project where multiple users will be updating.


You will notice that there is a CLEAR LOGIN button and DELETE LOCK button in the Admin form. You typically would never click these. However, if an end user's computer crashes, it may leave the login info and locked record info open in the database. This would be the way to clear them out for that particular user.


Hopefully you will be able to apply these controls in your project especially if you are storing the database on OneDrive.

164

(16 replies, posted in General)

Yes they can, but you need to be careful that they are not accessing and updating the same record at the same time. It could cause issues. It could potentially lock your database or at minimum you might not have the most updated info in it. There are ways through script to control the access to tables and records. Dimitry was kind enough to share an example in this forum. In addition to what he put together, you should probably also use the new login / roles feature of MVD to make it more robust and be able to see who is logged on and has various tables/records locked.


Here is the link to Dimitry's example:
http://myvisualdatabase.com/forum/viewt … 405#p21405

165

(16 replies, posted in General)

v_pozidis,
The first thing you need to do is obtain OneDrive from Microsoft. If you have Windows 10, you should already have OneDrive. If you don't see it on the left side of Windows Explorer, then you may need to sign-in or sign-up for it. Here is a link to do that:
https://www.microsoft.com/en-us/microso … ud-storage


If you do not have Windows 10 then here is the download link to get OneDrive. There is a free version if you use less than 5g of storage:
https://www.microsoft.com/en-us/microso … e/download


Once you have OneDrive your Windows Explorer should have a folder to get to OneDrive. I have it setup to sign-in automatically when Windows starts up. You can create folders on OneDrive just like you do on your computer. You can then copy your database to a folder on OneDrive. Then you indicate the location of your database in MVD Options. See attached screen image to see how you point to your database on OneDrive. Keep in mind that if you have multiple projects including your development project, you need to update the Options/Database Location settings in each project that uses the database. Also, if you have multiple users accessing it at the same time, you should have controls in place so that only one user is accessing a record at a time and lock other users when a record is in use.

166

(16 replies, posted in General)

v_pozidis,
I've not used Google Drive, but if Google Drive assigns a drive letter on your computer you should be able to use it. MVD needs to get to your data via a drive and path for SQLite db. I personally have used Microsoft's OneDrive and it works fine to store your database. It's the same concept as Google Drive. OneDrive assigns a drive letter and you can define folders as if it were on your computer. You can see the drive and its folders through Windows Explorer.

167

(26 replies, posted in General)

unforgettable,
I updated the project to include depts. The funny thing though is that in order to have a summary page as your first page, I had to bring back Derek's tablegrid solution to display summaries for the depts. See attached.


As far as a network, I don't know what your physical set up is. If you have several people working on their own computers, then yes you need some sort of wired or wireless network. Depending on the size of the business most businesses have a central computer called a server which houses critical data and then you have client computers accessing the data on the server. SQLite is not considered a client/server type database. You can have a few people accessing it, but you have to put controls in your MVD software to control when someone is accessing a record to see if it is already held by another user otherwise your database could get locked up or the wrong data could be saved. Dimitry put together an example on how to do that. You can search here on the forum for multiple user access. If I get a moment I will find it for you. I will say this much, you are getting into a much more advanced development. If you are new to development and new to MVD, you should master application development with MVD first, then get into multiuser environments. Depending on your situation you may need to use MySQL.

168

(5 replies, posted in Script)

One way you can do it is to place the same calculation from your calculated field inside Derek's calculated field.

169

(26 replies, posted in General)

unforgettable,
I am trying to figure out why you want this type of summary in a one row tablegrid when you can just simply place them directly on the form. I basically took Derek's example and removed the tablegrid and placed individual fields on the form. Obviously his way works based on what you showed on the form. I'm just giving you another option to show the same summary. It works the same way, just visually a little different. If it's not suitable to your needs just throw it away.

170

(26 replies, posted in General)

unforgettable,
It is sort of difficult to understand what you are trying to do without seeing a project or a picture of your requirement. However, I can tell you this much. Tablegrids can only hold data from one table. In a tablegrid you can bring in a lookup value based on a foreign key, ie DeptName from a Dept table in an employee grid, but you cannot have two tables (like master/detail table records) in a single tablegrid. There could be a workaround for what you want to do, but we need to know a little more detail of your requirement.

171

(12 replies, posted in General)

unforgettable,
Attached is the second picture for you regarding events.

172

(12 replies, posted in General)

unforgettable,
I got a chance to put something together for you to help you to understand events and how to trap and define procedures to execute on defined events. Hopefully you can understand the attached pictures. I'm not a trainer or documentalist so to speak, but hopefully it will help in guiding you in the right direction. I don't think I can post the two pictures I have in one post so I'll submit another post with the second picture.


Also, the following resources can help with the events and other pascal coding.
http://myvisualdatabase.com/help_en/   Scroll down to the "Script" section on the left side.
http://www.delphibasics.co.uk/

The Run Time Library Reference on the right side of the delphibasics website is a good resource. Not everything in Delphi is defined in MVD, but a good number are used in MVD.

173

(5 replies, posted in Script)

sdhale29,
Tablegrids are used to display records in a table. So in order to display the dropped files info in a tablegrid you need to create a table to hold the file info and then define a tablegrid to display the records. I created a small project to demonstrate it. I kept Dimitry's code in place and added the table inserts and grid update. I also deleted all records and cleared the tablegrid rows upon Form1 OnShow event. If you need to keep the records in your project, you can remove the procedure.

174

(12 replies, posted in General)

unforgettable,
I can assure you that the piece of code I provided will work on any project if it is defined correctly. You need to understand how to assign events on forms and controls. If you do not assign the same name to button click procedures as Dimitry assigned  in his example, it will not work either. If you need help in defining procedures and triggering events let us know.

175

(12 replies, posted in General)

unforgettable,
To prevent the save from adding the same record multiple times while keeping the form open, you need to put in a piece of code. See attached.