126

(26 replies, posted in General)

unforgettable,
A form can only update one record selected from a tablegrid at a time. By having the same fields defined on the form will only show the same data multiple times. I'm not sure what you are trying to do. Maybe you can explain a little more what you want to accomplish.

127

(4 replies, posted in Reports)

mickeywatsonnn,
The fixed project is attached. I removed "tablegrid1" from the Report Search. When included in the search the report will only report out the highlighted product in the tablegrid. When you add products it will automatically highlight that product in the tablegrid and therefore will only print that item. Removing the tablegrid from the search will print all items in the tablegrid.

128

(8 replies, posted in General)

derek and v_pozidis,
Attached is another option for an additional idea. The project I used came from Dimitry on the forum some time ago. I modified it slightly to include a tablegrid (tablegrid2) of the tasks just to see all the events in one place. You can click on a date on the calendar or click on a task in the task list to adjust the calendar and see the next 7 days of events and times in tablegrid1. It might not be what you exactly want, but it may give you a start.

129

(5 replies, posted in General)

Haven't seen Dimitry on here for awhile and now the forum is getting spammed. Does anybody know what is going on. Hope he is not sick.

CDB,
Try the following. I think your quotes may be your trouble.

sqlexecute('UPDATE orders SET id_productSupplier =  '+dbx+ '  WHERE id = '+idx);

131

(6 replies, posted in General)

MarkoS,
If you have fields already defined on the form and then you decide to insert a panel on the form, you cannot just move the fields onto the panel. You need to select all the fields you want on the panel, then do a cut and paste onto the panel. Once you do a paste onto the panel, all the fields will still be selected so you can then move them around the panel. Make sure that your panel is large enough to hold all the fields. You can always downsize the panel once you have the fields where you want them on the panel.

Or you can do the following to remove the popup altogether:

Form1.TableGrid1.PopupMenu := nil;

133

(6 replies, posted in General)

MarkoS,
If you do not want to use tables for storing combobox values as Derek provided, then you need to manually load the combobox through script. There are two options in how you store the combobox values. You can either store the actual text value from the combobox or you can store a numeric number (id) of the combobox value. Check out the two options in the attached example. FYI - Option 2 is the more efficient way for database applications. If you look at the raw data in the table you can see the difference between the two options in how the values are stored.

134

(4 replies, posted in General)

agusecc,
Here you go.

madbit71,
Try the attached.

136

(8 replies, posted in Talks about all)

You are correct. MVD does generate the script.pas automatically and you are also correct in that the absolute easiest way is to get the script.pas file from your friend. If you cannot get the file, you can still have the forms and tables available to you in MVD. You just have to figure out what pieces needs additional scripts to work. It looks like quite a complex app, so this may become a pretty daunting process. But to get you started with at least the forms and tables within MVD, open MVD and immediately do a save to save your new project to a folder on your computer. Then close MVD. Copy all the files and folders from your original project (from your friend) to the new project folder you just created. Open MVD and open your new project. The forms and tables should be visible inside MVD.

137

(7 replies, posted in General)

I'm not sure if the attached is what you are looking for, but you do not need an IF statement. You can use the onChange event on the combobox to retrieve the associated image from the database.

138

(8 replies, posted in Talks about all)

You indicated that you have the script.pas file, but it was not included in the project you uploaded. I suspect that the script.pas file was not part of the original project because that is a developers file and not an end user file. Unfortunately without that file it basically renders the app useless from a development standpoint because as soon as you recompile the project without this file, the app will not work properly. Some parts may work because of the use of standard MVD actions, but certainly not everything. The script.dcu indicates that there are definitely scripts that are required. I can get to the forms and database tables within MVD, but that's it. Unless Dimitry, the developer of MVD, has a way to re-create the script.pas file from script.dcu, I'm afraid you'll have to wait for your friend to provide the file. Sorry.

139

(8 replies, posted in Talks about all)

Umbigo,
If you remove the exe from the project folder and zip the rest, you should be able to upload to the forum. Since you do have the script.pas file, you may be in luck to recover. Make sure you upload the original project folder, not one that you tried to modify. Just curious as to why your friend is not helping you with this. Hope you are not trying to pirate it.

When you have a save action and you do not close the form, a second click of the save button will save the record as a new record. In other words a second click of the save button will produce a duplicate record if you do not close the form. The dbDontResetID prevents this from happening. It does not set the increment on id and maintains the same id so a second click of the save button just saves the same record. It must be placed on the save button's onClick event. To be honest I learned about it from Dimitry in one of his posts a couple of years ago.

derek,v_pozidis,
I was putting together a similar solution when I saw your post Derek. Not meant to step on you, but maybe it will give v_pozidis some additional ideas for his own project. My solution is very similar as yours. The only difference is that you can scroll through the tablegrid and display the record details. It's a tad bit more script, but some of it is not necessary. It just goes to show that there is more than one way to do things in MVD. The main point for v_pozidis is that you can still use NewRecord and ShowRecord on the same form as the tablegrid form.

142

(7 replies, posted in General)

unforgettable,
You could use the ComboBox filter in the Object Inspector on your second form. See attached.

There should not be a problem with that, but you will need to clear the form fields on FormShow otherwise the same fields will show up on the next form show and it will duplicate the record if you do not change the field contents. I'm not sure why you would want to do this.

144

(3 replies, posted in General)

v_pozidis,
Project is modified. It is pretty much the same code as in my previous post.

145

(5 replies, posted in General)

unforgettable,
Just start typing in the country field and it will fill in with matching entries from the country table. He's using a combobox for displaying but the actual table field being stored is in the text field.

146

(3 replies, posted in General)

v_pozidis,
I believe you have the relationship backwards in your database. So I switched the relationship and added script to incorporate the related field in the duplicate check.

147

(4 replies, posted in General)

vohans,
dbUpdate also updates the tablegrid from MySQL. If you have the tablegrid settings defined on the form, then placing the dbUpdate after your connection, as follows, will display the records in the tablegrid.

 if MySQL.Connected then
            begin
               Form1.TableGrid1.dbUpdate;  // This will display the MySQL records if you have the fields defined in the settings of the tablegrid.
               //ShowMessage ('DB OK');
            end;

CDB,
Look in my project. The categories work. You need to populate the combobox dbitemId from the Products id_part_categories. Look at the statement underneath the one where you populate the description.

CDB,
When you build a tablegrid manually or through SqlQuery and you need to get to the dbitemId for editing, etc you need to include id in your SELECT. See below. If you do not want to see the id in the tablegrid, then you insert "delete_col" in its place in the FieldNames. 

procedure frmEditPart_OnShow (Sender: TObject; Action: string);
begin

     frmEditPart.grdEditPart.dbSQL :='SELECT p.id,p.LineNumber, i.description,p.partModel FROM products p, productsupplier i INNER JOIN products ON ' +
     'p.id = i.id GROUP BY p.id ORDER BY p.lineNumber ASC;' ;

    frmEditPart.grdEditPart.dbListFieldsNames:= 'delete_col,BSuite#,Description,Model,Part Code,Supplier';
    frmEditPart.grdEditPart.dbSQLExecute;

end;

Categories work now too.

150

(4 replies, posted in General)

vohans,
Insert the following after you are connected.

Form1.TableGrid1.dbUpdate;