2,451

(2 replies, posted in SQL queries)

Good Morning Thierry,
Please look at the attached screen-shot.  Is this what you are meaning?
Whenever I have used the sqlsearch function, I have included the 'id' (to maintain the relationship) but have dropped it when outputting to the grid by adding the reserved word 'delete_col'
Maybe this helps.
Derek.

2,452

(5 replies, posted in General)

Hi Michael,
Yes, totally agree that copying a form should be a standard MVD function (together with quite a few other UI improvements that I hope will be in future releases) and that it's better NOT to edit forms.xml directly. 
BUT, given a choice between editing forms.xml and creating a copy of an existing form the long way, I'll choose to edit - LOL!
Derek.

2,453

(5 replies, posted in General)

Hello Wildo, Thierry,

I'm not sure I'm understanding what you mean by adjusting the grid size and spacing - do you mean the amount that objects move when you drag them across the form using the mouse?  If so, then you can 'fine tune' it using the LEFT and TOP object properties which moves the object by pixel.

I agree with the comment about copying a form which can't be done within MVD.   However, you can always copy and paste en masse all of the objects from one form onto a new 'blank' form using ALT+SHIFT+click which is pretty quick and easy.
Alternatively, if you want an EXACT copy of a form, I just edit the forms.xml file. 
1.  Open forms.xml using something like Notepad.
2.  Find the block of text where the form you want to copy starts and ends, copy and paste it and then just change the form name. 
3.  Save the forms.xml file, go back into MVD and there your copied form is. 

It takes about 30 seconds.  It doesn't really matter where you actually place it in forms.xml because you can always move it when you go back into MVD by dragging on the form tab.

For new projects, I use a projects template (which has all my standard tables, scripts and forms such as 'sign-on' forms, authorised user forms, help forms - all the stuff I use in every project).  And any forms specific to the new project that I need, I will then copy by editing forms.xml as outlined above.  It's amazing how RAD you can make MVD (great if you're lazy like me!!).

Maybe this can save you some time.

Derek.

2,454

(6 replies, posted in General)

Hi Stelios91,
Maybe you are meaning one of two things.
1.  If you want MVD to maintain a unique value for a record, you should use a COUNTER type field.
2.  If you want to assign a value to a field yourself  and ensure that this value is unique, you need to create a unique index;  this cannot be done within MVD at the moment but you can use a tool such as SQLite Studio to do this.
Here is a thread that tells you about it:  http://myvisualdatabase.com/forum/viewtopic.php?id=2055
Derek.

Hi Robb,
The relationship specified between your vendor and order tables already filters the orders raised against different vendors.
The filter on the auto-query would be if you wanted to additionally filter certain orders within the selected vendor (ie all orders over £100 or all orders older than 30 days etc).
Attached is a small project which is relevant to your example which might clarify things.
Derek.

2,456

(10 replies, posted in General)

Hi Jean,
Part of my problem is that
1.  I'm not sure which of the new tablegrid properties have not yet been fully implemented
2.  I'm misunderstanding what the new property is supposed to do
3.  The new property HAS been implemented and IS working but I'm simply doing something wrong (the most likely option!!!).
Thanks for the link - it will be very useful to read up on some of the options and get better informed.
Derek.

2,457

(4 replies, posted in General)

Hi Michael, Hi Thierry,
It's as tcoton says - groupbox is basically a cosmetic thing but it does enable you to put things inside a groupbox and move them all together (otherwise you have to use ALT+SHIFT+CLICK to move multiple objects at once).
But it's useful if you want to make certain parts of your form visible / invisible - you only have to set the visible property of the groupbox and everything inside that group box also becomes visible/invisible rather than doing it for each object.  And if you're writing a script to make something visible depending on a certain condition, you only need to script it for the groupbox which can save even more time.
Bringing to the front/sending to the back works WITHIN the groupbox (ie put one object on top of another and you can send to the back / bring to the front).  This is also true on the basic form - it's just not applicable to two objects, one of which is placed inside the groupbox and the other outside of the groupbox.
However, if there is an object that originally was outside the groupbox that you now want to place inside the groupbox, you don't need to delete it and create a new one;  you can just use cut and paste.
A 'panel' object also works in exactly the same way as a groupbox.
Hope that helps,
Derek.

2,458

(10 replies, posted in General)

Dmitry,
Look forward to seeing the new properties soon.  Thank you for the update.
Derek.

2,459

(10 replies, posted in General)

Hello Dmitry,
There seems to be a lot of new tablegrid object properties within "Options" that don't seem to do anything or maybe I am misunderstanding what they should be used for.
But there are 2 tablegrid properties that I am particularly interested in.  These are:
1.  Options/goInput
2.  Options/goInPlaceEditEvents
If I understand their meanings, both of these object properties should move MVD significantly towards in-grid editing.  Any news on when they might be available?
Thanks,
Derek.

2,460

(10 replies, posted in General)

Hello Dmitry,
I have a form that displays 2 tablegrids;  both table grids have been created in exactly the same way with identical object properties. 
The columns in both tablegrids are spaced so that horizontal scroll bars are not needed. 
But whenever I run the project, one tablegrid has the horizontal scroll bar showing, the other tabegrid does not (see attached screen shot).
I have also seen this happening on forms with just 1 tablegrid but it is more obvious with 2 grids on the same form.  The functionality is perfect but cosmetically, it is inconsistent.
Any idea why this is happening?

Also, do you have a timetable for when the new tablegrid object properties that were introduced in MVD2.3 but which haven't been implemented yet, will be available?

Thanks,
Derek.

2,461

(4 replies, posted in General)

Hello Montenegr0, Dmitry,
Attached is a little project that shows how to search with a filter using DateTime Picker (Kind=MonthYear) but it is the much the same with any field type.  The script is not necessary for the search - I just use it so the User does not have to press the mouse so much!  (that is why the search buttons are invisible).
I hope this helps.
Derek.

2,462

(2 replies, posted in Script)

Hello Identity,
Yes, this is possible.
All you need to do is write your two procedures (copyto and checkduplicate) and then attach them to your OnClick event
So, a simple example to show how
**************************************
procedure copyto;
begin
     form3.edit1.text := 'GoodBye';
end;

procedure checkduplicate;
begin
    form3.label4.caption := 'Cruel World';
end;


procedure form3_OnClick (Sender: string; Action: string);
begin
  copyto;
  checkduplicate;
end;
*****************************************************
Hope this helps,

Derek.

2,463

(3 replies, posted in General)

Hi David,
As I understand it (which could be wrong), the problem with OnAfterClick is as control passes from your previous form to the Contact form.
It should work if you attached your code to the contact_OnShow event for the Contact form instead. 
However, I'm not sure if that would be okay with how you want your form to work (although you could make it conditional on the action (ie if a new record, don't show the message, otherwise show the message etc).
Derek.

2,464

(4 replies, posted in General)

Hi Montenegr0,

As far as I know, there is no way to actually GROUP rows in a tablegrid as you might if you were using EXCEL. 
I think the nearest way to do it would be by applying filters to the tablegrid.  There are quite a few different ways of doing this and maybe your design means one way is better than another for you.

I think I would use calculated fields - so as soon as you create each 'day' record, a calculated field to hold the year and a calculated field to hold the month is automatically generated.  Then you can filter on either YEAR or MONTH or BOTH to only show records in your tablegrid that match your filter criteria.  The code to create the YEAR and the MONTH calculated fields is:
strftime('%Y', date) - for the year
strftime('%m', date) - for the month.

Hope this helps,

Derek.

2,465

(5 replies, posted in General)

Hi Montenegr0,
Have a look at the attached screenshot.
After you 'tick' the checkbox, you then need to click into each segment of the time (hours, minutes, seconds) and either type the values you want or use the 'up' and 'down' arrows on the right hand side of the datetimepicker field.  If you don't do this, it will always default to the current time.
Derek.

2,466

(4 replies, posted in General)

Good Evening EHWagner,
Agreed - it can be confusing about the dates and times, even though greyed out.  Attached is the way I get around it, if it's any help to you.
Derek.

2,467

(5 replies, posted in General)

Hi Montenegr0,

If I understand your question, if you are only interested in 'time' and not 'date', all you need to do is change the KIND property of the datetimepicker field to 'time' (the default is 'date') (see screenshot).

If you want to use both DATE and TIME, I find it easiest to use 2 fields, one to store the date (with KIND property defaulting to 'date') and one to store the time (with KIND property set to 'time).

If you want the date and time showing in the same field, I still use 2 fields and link them using the CALENDAR property of the datetimepicker field.  It would be much easier if you could do this all in the same field but if it is possible, I don't know of a way to do it.

Derek.

2,468

(2 replies, posted in General)

Hi Megood70,

I'd probably do it this way (although I'm sure there are other ways too).

procedure Form1_GridEmployees_OnChange (Sender: string);
var
   i,c: integer;
begin
  c := Form1.GridEmployees.RowCount - 1;
  for i := 0 to c do
  begin
    If Form1.GridEmployees.Cells[4,i] <= datetimetostr(now) then form1.GridEmployees.Cell[4,i].Color := clRed;
    If Form1.GridEmployees.Cells[4,i] >   datetimetostr(now) then form1.GridEmployees.Cell[4,i].Color := cllime;
  end;
end;

Hope this helps,
Derek

David,
Just noticed that in my example, the code for the two calculated fields is incorrect (bad copy and paste!!).
The code for the 'from' description should be (select location from locations where id = jobs.id_locations) - the 1st link between jobs and locations.
The code for  the 'to' description should be (select location from locations where id = jobs.id_locations1) - the 2nd link between jobs & locations.
Previously, they both pointed to jobs.id_locations1.
Sorry about that.
The ability to set multiple relationships between the same 2 tables is pretty useful.  In your example, you could dispatch from Point 1, going via Point 2 and Point 3 arriving at Point 4 simply by creating 4 relationships, 4 calculated fields and then use the same combo-box lookup.
A different use is that you can create multiple relationships between the same two tables but store completely different entities in the one table and then restrict what the combo-box displays with a filter (think about it as creating lots of 'sub-tables' all within one 'holding' table);  the advantage is that you don't need to create additional tables, additional forms etc etc - it's a huge time-saver.
Derek.

Hi David,
You need to define the relationship between your 'jobs' table and your 'locations' table twice (once for the 'from' locations and once for the 'to' locations).
This however, will only display the internal keys values of the 'from' and 'to' locations on your tablegrid so you need to also add calculated fields to bring in the actual location descriptions (you actually only need to get the 'to' location description - the standard MVD software will get you the 'from' location description - I've just done both to make it a bit easier to follow).
Oh - just seen that Dmitry has already sent you the solution - anyway, here's what I knocked up (which is much the same).
Good Luck
Derek.

2,471

(5 replies, posted in General)

Hello Identity,
If you don't want to change your forms, you can delete sqlite.db and let MVD recreate it when the project next runs.  This cleared the error when I tried it.
A bigger problem is that in Form 4, you are adding "formtwo" records without relating them to a parent "formone" record - but in your database schema you have specified such a relationship.  Maybe this is just in the example project you uploaded and in your real project the records are related correctly?

2,472

(11 replies, posted in General)

Hi Dmitry,
Thanks for the plan stage project example - I've just been looking at it and it's clever stuff. 
I look forward to using some of it in my next project.
Derek.

Hi Timlitw,
I've done something similar before - I've attached a copy of it for you to have a look at.
There's none of your original code but it's just a case of copy and pasting it in.
I've just added a calculated field to get the maximum next due date so that can display in tablegrid 1 and I guess the colour coding would run off that.
Hope this helps.
Derek.

Hi David,
In "strict" database design terms, you should look to only hold repeating data once (although we all know that rules are made to be broken - LOL!).  The approach that you were possibly thinking about is one that is more often seen in spreadsheets.
I was mindful that the first example I sent you earlier was very 'rough', but I was in a rush!  Now I have a bit more time so I've attached another example (slightly more polished!), to show you a different approach (but the principle is much the same);  this second example requires a small amount of script to do a couple of things "behind the scenes" to avoid the User having to 'click'.
BTW, it is the presence or absence of the 'dateout' that  automatically switches a record between the 'open' service and the 'closed' service tablegrids (but I'm sure you've already picked up on that).
Both this example and the one from earlier today will work okay with your current version of MVD.
Good Luck,
Derek.

Hi David, Dmitry,
Welcome to MVD - good choice!
There isn't any restriction on what you are trying to do and I'm sure Dmitry will be able to give you some neat alternative ways of achieving what you want.
But your scenario sounds a lot like something I've just finished.  So I've quickly hacked a copy of it and changed the labels so that it's easier for you to relate to. 
In my example, I don't bother having a separate button to show service history (it's one more thing to click!) and have it all on the same form which makes it very straightforward;  'open' service items are sorted to the top of the service history tablegrid and 'closed' items are then displayed below that.  If you prefer, you could use 2 tablegrids (again, all on the same form) with the 'open' service record in one grid and the 'closed' service records in the second grid.  If you need showing how that's done, just let me know.
All of this is without having to write any scripts etc so it keeps things nice and simple.
Good Luck and I hope this helps to point you in the right direction.
Derek