Hi EHWagner, Hi Dmitry,
I was having a look at your problem (which I think is actually more awkward than it initially appears!).
Creating inserts into the parent-copy and child-copy tables is relatively straightforward. However, I believe Dmitry's example encounters the same two basic problems that I was concerned about. They are:
1. DELETIONS - if you delete a parent record and any child records, presumably you want to check if there are any associated parent and child records in the parent-copy and child-copy tables and have them also deleted. Awkward because both pairs of tables are essentially 'stand-alone' and there is no record-id to relate them, so you are relying on users to also make the same deletions in the copy tables (which they all say they will do but we know they won't !!).
2. CHANGES - if you change a parent record and any child records, presumably you want to check if there are any associated parent and child records in the parent-copy and child-copy tables and have them also changed. Again, awkward. In Dmitry's example, a change to the parent and / or child record creates an INSERT in the parent copy table. But to be fair, I think Dmitry's example is only currently intended to perform inserts.
Taking the two problems together, you could find that, rather than the copies being sub-sets of the original tables, they will quickly start to hold completely different records.
Still, it's an interesting problem and I'm sure there's a way of doing it. I'll let you know if I come up with anything.
Derek.
2,701 2015-12-12 01:22:13
Re: Calling on SQL Experts (20 replies, posted in SQL queries)
2,702 2015-12-11 14:36:57
Re: Calling on SQL Experts (20 replies, posted in SQL queries)
Hello EHWagner,
I found your problem far more interesting that what I'm supposed to be doing right now - LOL! So......a couple of questions.
1. Will the second parent table ALWAYS be populated (so it can be automatic) or just occasionally (so it would be a manual request)?
In other words, if the first parent table has 1000 rows, will the second parent table also have 1000 rows or only a subset?
2. Will this also be true between the first and second child tables?
The reason for the questions is that I can see a scenario where you don't always want the parent record to be copied but when you DO copy a parent record, you would ALWAYS want the child record(s) to be copied.
3. Is this mainly to avoid having to enter data twice?
I've mocked up a couple of quick solutions but would just like to know the answers to 1. 2. and 3. above before I see which is most suitable.
More generally, I'm intrigued as to why you need to create the additional parent / child tables in the first place.
Derek.
2,703 2015-12-11 13:58:47
Re: Enabling / disabling objects depending on the use (16 replies, posted in General)
Hi TCoton, Mathias,
Yes, it can make the form look unbalanced.
You could replaced the xxx.visible := false with xxx.enabled := false. That might make it look better.
I've attached an example - it might not have all your conditions, but the principle is the same.
Derek.
2,704 2015-12-11 11:55:23
Re: Enabling / disabling objects depending on the use (16 replies, posted in General)
Good Morning TCoton, Mathias,
If I understand your problem correctly, yes, I would do it exactly the same way as Mathias suggests.
Derek.
2,705 2015-12-10 21:05:41
Re: Master-Detailed (9 replies, posted in General)
Good Evening Mathias, Smoustafa, Jean and Dmitry,
@Mathias
It is true that we never know what we don't know - till someone else mentions it!! Then you think "I wish I'd been aware of that 6 months ago!!"
In case you are interested, I have attached a small project I was working on that does a lot of master / detail work. This includes doing all of the Adds, Changes, Deletions and Searches just using one form.
The script is messy (!) because users wanted to be able to do as much as possible with keyboard short cuts because it is quicker for them. So much of the complication is trying to keep focus on the grid, remembering what row you are positioned on etc etc. If you do not need any of those things and can use the mouse, the script would be quite simple.
Hope it gives you some ideas,
Derek
2,706 2015-12-10 13:06:45
Re: Master-Detailed (9 replies, posted in General)
Sorry - the attachment didn't upload!! Here it is.
2,707 2015-12-10 13:03:54
Re: Master-Detailed (9 replies, posted in General)
Hi Smoustafa, Mathmathou, Dmitry,
Normally, you would use a separate form to show the fields of the record you select in the tablegrid. But there is nothing to stop you from showing those fields on the same form.
Attached is Mathmathou's example but done without using a script. (Sorry Mathmathou - I was too lazy to write an example so I stole yours - LOL!).
Hope this helps.
Derek.
2,708 2015-12-09 12:26:56
Re: File menu (29 replies, posted in General)
Hi Roger,
I think the problem could simply be the sequence in which your forms are held.
I downloaded your project and encountered the same problem as you.
When I switched the sequence of the forms, the error is corrected (see roger.jpg).
Maybe this helps.
Derek
2,709 2015-12-08 16:20:43
Re: File menu (29 replies, posted in General)
Hi Roger,
You only need to disable the file menu options once, on the first form that is called when you run your application. So, your script would typically read as follows:
procedure Form1_OnShow (Sender: string; Action: string);
begin
form1.mniAbout.Visible := False;
form1.mniOptions.Visible := False;
form1.mniFile.Visible := False;
end;
The menu options on Form1 and any other form are now all removed.
Hope this helps,
Derek
2,710 2015-12-07 16:27:35
Re: Can't mark database field as "not null" (8 replies, posted in General)
Hi Jumper,
Yes, my understanding is that you have to use the 'edit' icon and then the 'additional' option - you can't simply insert a tick on the first 'database tables' screen (even though it looks like it you can).
Notwithstanding that, you would still hit your original problem if you'd already started adding data to any of the tables.
Derek.
2,711 2015-12-07 13:44:51
Re: Can't mark database field as "not null" (8 replies, posted in General)
Hello Jumper,
Usually you will get this problem if you have already started to add data to your project in ANY of your tables, not just the table that you are trying to make a field not nullable in.
In the directory where your project files are held, delete the sqlite.db file, go back into your project and you should then be able to make the required field not nullable. For this reason, it's best to only enter a small amount of test data until you're 100% sure of the structure, conditions etc to avoid having to re-enter stuff.
Hope this helps,
Derek.
2,712 2015-11-24 15:55:32
Re: Beta version 1.51 (14 replies, posted in General)
Hello,
Maybe is good idea to create function , to select all items on form to move them , with one move with mouse.
Now i must select all Tb or Cb and others items and move be one. I think this option help to fast graphic edit the forms.Brgds,
K.
Hi Krokodil_sk, Hi Dmitry,
I am not sure if I understand your issue correctly but you can select multiple textboxes, comboboxes, grids etc to move at the same time by holding down ALT and SHIFT. It makes designing your forms much quicker.
However, (for me) this only works if you move them using the mouse; if you try to move them using the arrow keys, it only moves the first entity you selected on the form, not all of them.
Hope this helps,
Derek.
2,713 2015-11-20 11:39:31
Re: Tablegrid Questions (5 replies, posted in General)
Sorry - forgot to add the screenshot!
2,714 2015-11-20 11:37:43
Re: Tablegrid Questions (5 replies, posted in General)
Good Morning Dmitry, Ehwagner,
I've wanted to do something similar before - the only way I could think was to remove the column headings in the grid completely and replace them with labels - then you can use whatever size, colour, font etc you want (or mix them!) (see attached screen shot).
But it's not really a solution - more of a work-around - and of course, if a User resizes the column widths, it messes things up.
Derek.
2,715 2015-11-16 19:47:46
Re: Need Help With Filter (9 replies, posted in General)
No problem, and glad it helped.
There's a few of the users who are happy to help out (probably because we've all been there at some stage!) and Dmitry (Mr "My Visual Database") is totally amazing at getting back to you with answers and suggestions to all sorts of questions.
Most of what I've picked up is from downloading other people's projects that were attached to posts in this forum and reading through how they tackled various things and then carrying on from there.
MVD is an excellent tool - hope your evaluation goes well and you decide to stick with it.
Derek.
2,716 2015-11-16 17:02:46
Re: Need Help With Filter (9 replies, posted in General)
Hi,
Please find attached a rough and ready version of the 'sellercrud' form with a buyers grid attached.
You need to be careful when you scroll through the various buyers in the sellercrud.tablegrid1 because you are actually in 'amend' mode and will change the business type for the particular seller that has been pulled through onto the 'sellercrud' form.
For that reason, I would probably just use the 'match' form instead - it shows exactly the same information as the 'sellercrud' but without that risk. I've deliberately left the buyercrud as it was before so you can compare the two different approaches.
Hope it helps,
Derek.
2,717 2015-11-14 18:03:21
Re: Need Help With Filter (9 replies, posted in General)
Hi Again Ehwagner,
Don't know about awesome - just learn a lot from my mistakes along the way!
To get around the problem you have with adding new records and it not showing immediately, it might help if you attach a little bit of code to the 'on after save' button event to update the affected grid (eg - form1.tablegrid1.dbupdate;) - that often does the trick. I imagine you would also have the same problem if you were deleting a record or amending its Business Type.
I had a bit more time today so I reworked my previous 'rush-job' to include the tablegrid1.dbupdate code and some other bits as well. It's attached if you want to have a look at it and then chop it about to suit. I'm sure it's different to how you want it to work in 'real-life' but it might give you some ideas and clues as to how to do certain things in MVD.
Good Luck,
Derek.
2,718 2015-11-13 19:14:09
Re: Need Help With Filter (9 replies, posted in General)
HI Ehwagner,
Once you've set up a 'SEARCH' button, you have a choice of either 'clicking' it or of having it fire automatically.
In the knock-up example I did, to fire it automatically, you use the 'incremental search property of the search grid to associate it with BUTTON1 (obviously, you don't have to hide the button but it just makes it look neater) - see attached.
It was quickest (I'm lazy!) to show you using the SELLANDBUY form but the principle is exactly the same if you want to put the buyer grid on the SELLER form instead as you suggest.
Glad it helped.
Derek.
2,719 2015-11-13 14:33:04
Re: Need Help With Filter (9 replies, posted in General)
Hi Ehwagner,
From what I can deduce, you're on the right lines.
Rather than try and explain, I've just knocked up a quick app to show you one of the many ways it could be done. In my example, I've used 2 grids and highlighting a row in the seller grid shows all the possible buyers that have the same business type.
Sorry that it's so 'rough and ready' but I hope it helps to move you on a bit.
Derek.
2,720 2015-11-13 11:09:16
Re: SQLQuery and grid formatting (10 replies, posted in SQL queries)
Hello Dmitry,
I have tried both your solutions and they work well.
I prefer your idea of putting the SQLQuery code into the script so that all of the grid formatting is properly maintained - looks much better.
As always, thank you for your help.
Have a good day,
Derek.
2,721 2015-11-11 14:46:20
Topic: SQLQuery and grid formatting (10 replies, posted in SQL queries)
Good Afternoon Dmitry,
A bit of help please.
I have 2 currency fields, both defined to 2 decimal places and with a ',' as a thousands separator.
In my tablegrid when all rows are retrieved, this is displayed correctly, for example 1,234.00 (dmitry 1.jpg).
After doing an SQLQuery search, the formatting is lost and displays as 1234 (dmitry 2.jpg).
Can the correct format be specified as part of the SQLQuery?
If not, what is the syntax for specifying it in the script?
Thanks,
Derek.
2,722 2015-11-10 14:21:04
Re: Movin Data From list 1 to 2 (4 replies, posted in General)
Hi,
I am not sure if you have a need to store the cars you 'buy' and the cars you 'sell' in 2 separate tables with all the extra problems that might cause.
You could use just 1 table with extra fields to hold additional information about the 'sold price', 'sold date' etc.
Then all you need is 2 grids with filters - one grid automatically shows cars that haven't been sold (for example, with a 'sold price = 0.00) and the other grid automatically shows cars that have been sold (sold price > 0.00).
I have attached a little example of how I might do it if it helps.
Derek.
2,723 2015-11-09 13:14:46
Re: List filtered rows in Grid (13 replies, posted in General)
Hi TCOTON,
Can't believe it - a typo! Great spot! A new pair of glasses for me, I think.....
Thanks for the link to cell justification. I'm reasonably okay with grid formatting - my original question was more to do with the inconsistency - why you don't need to explicitly format it when you're simply viewing the grid but you then need to format it as a result of using an SQLQUERY.
Thanks again,
Derek.
2,724 2015-11-07 21:47:02
Re: List filtered rows in Grid (13 replies, posted in General)
Hi TCOTON,
I thought that when I first had the problem so tried it with just 2 conditions but it still didn't work.
And then I left outer joined instead - and still it didn't like it! There is something wrong somewhere but I can't find it!
The only way I have got it to work is by using separate search fields for each column in the grid rather than using an SQLQUERY; if I can't fix it, I may end up doing that on all the other columns as well, but it isn't quite the way I wanted it to be done.
Thanks again for your interest.
Derek.
2,725 2015-11-07 13:48:30
Re: List filtered rows in Grid (13 replies, posted in General)
Hi Tcoton,
Thanks for checking it out - I appreciate that.
I've tried changing the condition in the SQLQUERY a number of ways but it always comes back the same.
I hope Dmitry can find out what the problem is.
Derek.