Hi EHW,
That all makes perfect sense now.
I actually wrote something not too dissimilar many years ago and the concept of the 'leads' table is bizarre - it's virtually stand-alone with only a very loose relationship to any of the other tables in the database.
In the end, I think I 'cheated' by having just a 'clients' table but one of the rows in the 'clients' table was for a client called 'Leads' and if any of the queries against the 'Leads' client got firmed up, I then created it as a proper client and copied the data over.
It sounds like quite a large project you're undertaking. Best of luck and keep us updated with how it's going - it looks pretty interesting.
Derek.
2,751 2015-12-16 01:56:24
Re: Calling on SQL Experts (20 replies, posted in SQL queries)
2,752 2015-12-16 00:04:44
Re: Add items to a combo box (6 replies, posted in General)
Good Evening Jumper,
It's 'standard' MVD which is why the script is empty (apart from the "hello world").
Using the example I knocked up, the 2 digit code and the description are fields in a table called 'states'; it is the table that gets populated, NOT the combobox. The combobox is just a way of letting you pick a value from the 'states' table. It is not a table itself and doesn't hold any data.
Have a look at the attached screenshot and follow it through.
On Form1 click the 'STATES TABLE' button. This takes you to Form4 which is a list of rows in the 'states' table that have been added so far.
Click the 'ADD STATE' button to create more entries in the 'states' table..
When you have finished, go back to Form1 and click on the 'ADD' button to go to Form3 where you start adding suppliers.
This is where you see the combobox in action - remember, it is simply a convenient way of presenting you with a pick-list of values held in the 'states' table.
Hope this clears things up a bit and if you need any more help, just shout.
Derek.
2,753 2015-12-15 18:50:40
Re: Add items to a combo box (6 replies, posted in General)
Hi Jumper,
Apologies if I've misunderstood your question.
You can't (easily) populate entries directly into a combo-box (like in Excel). Entries need to be added to a table first like any other data field(s).
Once created, these entries are then referenced by using a combo-box on the form where the data is required.
I've attached a knock-up (it's easier to show it than to explain). I've used 3 different 'styles' for the combo-box entries with 3 discrete 'save' buttons:
1. the 2 digit state code
2. the state description
3. the two concatenated together
Obviously, you wouldn't normally have all 3 on the same form, I've just done it to show you the options you have.
Hope this helps,
Derek
2,754 2015-12-15 12:56:39
Re: launch browser to look up a zipcode in Google maps (9 replies, posted in General)
Hi Jumper, Mathias,
I've been using www.google.com/maps/place for a while now in an application and it works fine.
In England, we use postcodes that take you straight to specific streets so it is great for cross checking data.
In the application, I build 2 urls from my address data:
1. a url using just the postcode which, when clicked, lets me confirm the street and town.
(eg. www.google.com/maps/place/wv95lj)
2. a url concatenated from the street and town which, when clicked, shows me the associated postcode.
(eg www.google.com/maps/place/lesscroft+close,+wolverhampton)
While the postcode search is perhaps more relevant to England, the street and town search works world-wide. For example,
www.google.com/maps/place/armitage+close,+red+deer (in Canada)
www.google.com/maps/place/lynne+place,+longview (in USA)
www.google.com/maps/place/carrer+san+francisco,+altea (Spain).
Hope this helps others with similar requirements.
Derek.
2,755 2015-12-14 23:27:17
Re: Calling on SQL Experts (20 replies, posted in SQL queries)
Evening EHWagner, Dmitry,
If you are going to keep changes and deletions in sync between the main tables and the copy tables manually, then most of the complications that I foresaw go away (thank goodness!).
To help keep things in sync, I think I'd perhaps use something like auto-generated 'counters' on the parent and child master tables that would then get copied across to the sub-set parent and child copy tables. Matching on the 'counters', you could then use a simple tablegrid to highlight any inconsistencies between master and copy records (where one had been changed but the other hadn't, or where the number of child records belonging to a parent record was different between the master and the copy etc etc).
It's quite unusual to purposely duplicate actual data in a database. Can I ask what your requirement is to hold a PHYSICAL subset of the parent and child tables rather than just creating a VIRTUAL subset by using something like tablegrid filters? Then all of the issues of inserts, duplicate data and keeping records in sync would disappear.
Derek.
2,756 2015-12-13 23:50:44
Re: Enabling / disabling objects depending on the use (16 replies, posted in General)
Good Evening Tcoton,
I have always been puzzled that the attributes of the objects on the form do not get reset when it is closed.
So I end up ignoring an object's default status and set it explicitly one way or the other which takes more time and makes the script longer, but it's the only way I know to make sure it works 100%.
Sorry - I know it's not what you wanted to hear - LOL!
Derek.
2,757 2015-12-12 18:42:26
Re: Enabling / disabling objects depending on the use (16 replies, posted in General)
Hi TCoton, Hi Matthias,
It is also quite nice not just to set various fields to enabled := false but also to change their colour otherwise the user might be tempted to try and click in fields that are still showing 'white' - I tend to use clbtnface to be consistent with other Windows applications where an option isn't available.
I changed the example I did to show this and it is attached. Of course, it is a few more lines of code but if it stops errors and makes it easier to use, then it is worth it.
I'm sorry but I'm not sure what you mean when you ask "what is the function check?"
Anyway, hope this helps.
Derek.
2,758 2015-12-12 01:22:13
Re: Calling on SQL Experts (20 replies, posted in SQL queries)
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,759 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,760 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,761 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,762 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,763 2015-12-10 13:06:45
Re: Master-Detailed (9 replies, posted in General)
Sorry - the attachment didn't upload!! Here it is.
2,764 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,765 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,766 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,767 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,768 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,769 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,770 2015-11-20 11:39:31
Re: Tablegrid Questions (5 replies, posted in General)
Sorry - forgot to add the screenshot!
2,771 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,772 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,773 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,774 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,775 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.