501

(21 replies, posted in General)

Adam, in your case you will need to make some adjustments. In the ClearAllComponents procedure you need to remove or comment out the following line:

IF Form.Components[i] is TdbStringGridEx Then TdbStringGridEx(Form.Components[i]).ClearRows;

Keep in mind that any form in your project from here on will not clear tablegrid rows with this procedure.  In the button procedure which calls the ClearAllComponents you can place the individual tablegrid to clear.

procedure Form1_Button48_OnAfterClick (Sender: string);
begin
  ClearAllComponents(Form1);
  Form1.TableGrid1.ClearRows;  //Clear rows on selected individual tablegrids
end;

Also, notice that this procedure is setup to fire off on the button after click event. I think that's why you are getting the "No Record Selected to delete" message. You want to clear after the delete action. Clearing before the delete action means there is nothing to delete when the action takes place. Hope this helps.

502

(21 replies, posted in General)

Thanks Dimitry. As I'm sure you are quite aware, software development can make one feel stupid. Sometimes you can't see the forest for the trees. I had your same "If" statements in my routine but it wasn't working. It took me a minute to figure out why yours worked and mine did not. As it turns out I forgot to place the "Begin and End" combination in my "For loop".  I should have known since I was not getting a syntax error. Thanks for opening my eyes (LOL) and helping Adam too.

503

(21 replies, posted in General)

Adam,  I understand what you are asking. Unfortunately I don't have an answer for the other field types clearing in the For loop. I am hoping Dimitry provides an answer. I am interested in knowing it also.

504

(21 replies, posted in General)

Thanks for the correction Dimitry.

505

(21 replies, posted in General)

Adam, try this.

procedure Form1_Button6_OnClick (Sender: string; var Cancel: boolean);
var i : Integer;
begin
       For i := 0 to Form1.ComponentCount -1 do
       IF Form1.Components[i] is TdbEdit Then TdbEdit(Form1.Components[i]).Clear;
end;

You would place this on your delete button to clear after your delete.

506

(48 replies, posted in General)

Adam, Fixed project is attached. In your project the notes memo field was memo20 not memo24. ReportNotes is a text field so ReportNotes.value should be ReportNotes.text.

507

(48 replies, posted in General)

Attach your project Adam and I'll take a look at it.

508

(48 replies, posted in General)

Adam,


The report was built using the "ReportSQL". I adjusted the "Report" to print the same invoice format. There are two reports 1) Invoice.fr3 and 2) InvoiceSql.fr3. Each report button will run it's respective report.

509

(48 replies, posted in General)

Sorry Adam, I could not replicate the error. It works fine for me.

510

(48 replies, posted in General)

Thank you Adam for the full size images. I am certainly not an expert when it comes to record level images whether they are stored in the database or linked externally. I don't typically work with them. But for my own edification I did some research in the forum and found the following project from Dimitry where you can link an image in a report through a script. I went ahead and updated your project with the same type script.


http://myvisualdatabase.com/forum/misc. … download=1


Something I learned (at least I think I learned) when it comes to defining images externally (LinkFile).  Apparently, you still define the image in the table, but it is never loaded (null) and you define another field for the actual image file name. It's kind of awkward. The calculated field in the table kind of threw me.

511

(48 replies, posted in General)

Adam.


For the sake of getting you the screenshots I used the Post Image site. But I really would prefer to place images directly into the post. I hope somebody can demonstrate how to do that. Hopefully this will help you understand the workaround for the Group Footer.


Click on the following thumbnails.
https://s24.postimg.org/78s43ls75/Group_Footer_Definitions.png


https://s24.postimg.org/5jj0vjcht/Group_Header_Markup.png


https://s24.postimg.org/8p3mlqv41/Group_Footer_Script.png


Also, in your database the second company (id=4) did not have the logo image loaded in the record. Your company tablegrid loaded the image into the grid through script, but the record did not have the image. That's why it showed in the tablegrid, but not in the report. I put the image in the record and it shows in the report now.

512

(8 replies, posted in Script)

You need parentheses around the equations on each side of the "and". See below for fix.

         begin
             if (frmMain.tgDrawings.Cells[k,i] = '1') and (frmMain.tgMembers.Cells[k,i] = '1') then frmMain.tgMembers.Cell[k,i].Color := clGreen;
             if (frmMain.tgDrawings.Cells[k,i] = '2') and (frmMain.tgMembers.Cells[k,i] = '2') then frmMain.tgMembers.Cell[k,i].Color := clGreen;
             if (frmMain.tgDrawings.Cells[k,i] = '3') and (frmMain.tgMembers.Cells[k,i] = '3') then frmMain.tgMembers.Cell[k,i].Color := clGreen;
             if (frmMain.tgDrawings.Cells[k,i] = '4') and (frmMain.tgMembers.Cells[k,i] = '4') then frmMain.tgMembers.Cell[k,i].Color := clGreen;
             if (frmMain.tgDrawings.Cells[k,i] = '5') and (frmMain.tgMembers.Cells[k,i] = '5') then frmMain.tgMembers.Cell[k,i].Color := clGreen;
             if (frmMain.tgDrawings.Cells[k,i] = '6') and (frmMain.tgMembers.Cells[k,i] = '6') then frmMain.tgMembers.Cell[k,i].Color := clGreen;
             if (frmMain.tgDrawings.Cells[k,i] = '7') and (frmMain.tgMembers.Cells[k,i] = '7') then frmMain.tgMembers.Cell[k,i].Color := clGreen;
             if (frmMain.tgDrawings.Cells[k,i] = '8') and (frmMain.tgMembers.Cells[k,i] = '8') then frmMain.tgMembers.Cell[k,i].Color := clGreen;
             if (frmMain.tgDrawings.Cells[k,i] = '9') and (frmMain.tgMembers.Cells[k,i] = '9') then frmMain.tgMembers.Cell[k,i].Color := clGreen;
             if (frmMain.tgDrawings.Cells[k,i] = '10') and (frmMain.tgMembers.Cells[k,i] = '10') then frmMain.tgMembers.Cell[k,i].Color := clGreen;
         end

513

(48 replies, posted in General)

Adam,


You have hit on a nuance, qwirk, snafu or whatever you want to call it with Fast Report and MVD. For some reason, you can place calculated totals in the footer, but you cannot place report fields in there. But all is not lost. You have to go around the woods to get to grandmother's house in this case. In a nutshell, you have to place the report fields that you want in the Group Footer into the Group Header. In your case you don't want to see these fields in the Group Header, so you have to hide them (white text font). Then you can define label fields (memo in Fast Report terms) in the Group Footer. Then using Pascal script in Fast Report you can populate and format the Group Footer fields with the hidden fields in the Group Header.


I have screenshots, but not sure how to place them here in the post. I'm winging it. Hopefully they show.


Well they did not show. Maybe somebody can enlighten me in how to place images in the post.

514

(48 replies, posted in General)

Adam,


Since multiple companies can share customers, I removed the relationship between customers and companies. I fixed your ReportSql and put in the report bands for the invoice. I did not format anything in the report bands. Just wanted to show you the placement of the data in the bands.

515

(1 replies, posted in General)

You need to place the following code in the "Save Button" Onclick event:

Form1.buttonSave.dbDontResetID := True; 

That should take care of your issue.

516

(48 replies, posted in General)

INNER JOIN Company ON SaleInv.id_Company =Company.id
WHERE SaleInv.invCode = '{edSaleInvCode}'

Adam,


I suspect after defining the relationship you probably did not populate the SaleInv.Id_Company field. Without values in there the query will not return anything. However, I don't think I would recommend setting up that relationship unless you have an underlyng reason for doing so. It could cause a conflict along the way. You could essentially assign an invoice to a company and simultaneously to a customer which could already be assigned to another company. Each company should have there own set of customers and invoices. I would stick to the schema set up by Mathias.

517

(23 replies, posted in General)

Adam,


Actually it is working. I think you may be running into a situation whereby the max count is set to a lower number than the number of backup files already in the folder. It is removing the oldest file, but it does not remove additional files to bring it down to the max. I wasn't sure if you wanted to do that because a user could reduce the max count down to a very low number from a higher number and then you would lose all the backup files already stored. However, if this is acceptable to you, then use the attached project which will always maintain the max count of files as defined.


I know I could have used the radio button simulation code, but I was thinking that maybe a user may want to maintain a backup in the main folder and a duplicate copy in an alternative drive. But if you prefer to only select one backup location, then by all means use the simulation code. You will need to incorporate that code in the attached project though.

518

(23 replies, posted in General)

Adam, I updated your BackupEmployees project with your database backup setting form. I'm a little confused as to the two options for backup destinations (radio buttons). Theoretically a user could backup one time into the app folder and the next time into another folder and so on. You could have mixed backups in different folders, which potentially could be cumbersome to determine the most current backup for a restore. Since MVD does not have radio buttons I used checkboxes. And yes, a user could potentially backup in two places at the same time, which isn't necessarily a bad thing to have double protection. It's totally controlled by the user though. The other options for app start backup and app exit backup as well as the automatic backups and Max count are all functioning. Hope it' meets your requirements. If not, maybe at least it will get you further along in the process.

519

(23 replies, posted in General)

Adam, a couple of questions. Is the form you presented, to be used for just backup settings and the backup will be run somewhere else or is the form intended for the settings and running a backup too? The reason I ask is that the first checkbox kind of confused me. Also, if the user elects not to use a date stamp in the backup file name (the last checkbox), how are you going to distinguish the file names in the backup folder? I recommend using the date stamp for all backups.

520

(23 replies, posted in General)

Adam, If I may add another possible solution to your backup process. Typically once you define a backup folder you would want to backup to that same folder without re-selecting the folder each time you do a backup. I usually have a settings/control table which stores definitions for my applications. One of these definitions can be a backup folder. In the attached project, the first time you run a backup it will ask for a folder to store your backups. Once you select a folder, then each time you run a backup it will copy the database, with a time stamp, and store it in the selected folder without asking for the backup folder over and over. If in the future you want to change the backup folder just go into the Options | Define Backup Folder and select another folder to store your backups. I also added the feature to remove the oldest backup when the threshold of backups has reached five.

521

(2 replies, posted in General)

I think I understand now. See attached to see if that is what you are wanting to do. The print button only prints a single employee selected in the table grid.

522

(11 replies, posted in General)

Sorry for being dense, but I'm not following what you want to do. Maybe Dimitry or someone else can chime in to help.


I did notice that none of your employees have users assigned, if you are wanting to report on employees assigned to the logged in user.

523

(11 replies, posted in General)

Not sure I understand. All I did was replace the user name with the Stamp info. I didn't change any reporting logic. Your ReportSql is selecting all records.

524

(13 replies, posted in General)

Ok Adam I revised your latest project to hide/unhide the delete button. See attached.

525

(13 replies, posted in General)

Adam, the SAVE button only shows after entering the second password when changing or removing the password. Keeping the two passwords empty will automatically remove the password. In my revision there is no need for the Delete button. Also. if you want to see the existing password, just remove the password character in the properties.