1,676

(3 replies, posted in General)

Hi DBK,
Works fine for me (MVD 5.4 and Windows XP) using the properties tab.
Are you choosing an unusual font (not all the fonts that are displayed in the drop down list are supported) but all the usual culprits should work okay.
Derek.

1,677

(59 replies, posted in Database applications)

Hi JB,
Sorry - I didn't see that you'd already replied to Darek.  But I think we're both suggesting something similar.
Regards,
Derek.

1,678

(59 replies, posted in Database applications)

Hello Darek,
1.  If a field can only have 'yes' or 'no' (or optionally 'neither' as its value, you can choose to define it in your data structure as 'boolean';  use a 'checkbox' on your form and this then shows in tablegrids as 'yes' or 'no'.
2.  I put your CSV into a spreadsheet and -
  a) got unique values for categories and gave each value a sequence number (key) - this became the 'categories' table
  b) got unique values for film title / year and gave each value a sequence number (key) - this became the 'films' table
  c) added the relevant keys (id_films and id_categories) to the nominations - this became the 'nominations' table
I used a utility called SQLiteStudio (it's free) to do the initial data load (you can use MVD import routines (probably the 'correct' way to do it!) but I find it just as quick this way).
I've changed the way the number of nominations for each film and the winners for each film is processed - using calculated fields was slowing it down a bit.
I have added a (temporary) button on Form1 (see attached) called 'Raw Data' - it shows you how all the data is stored in the 3 tables in your database.  It might help you to understand how MVD (and all relational database products) works.  You can just delete the button and associated form when you don't need it any more.
Look at the screenshot in the attachment and see how the data is linked together - for example, '2001 A Space Odyssey' has an ID of 18 - then look at the nominations table in the id_films column with a key of 18 and you'll see the 4 nominations.  Look at the id_category column and follow each of the 4 keys to the 'category' table to see which category it relates to etc, etc. 
Of course, MVD does all this for you automatically but I think it helps if you understand the basic principles behind it.
Regards,
Derek.

1,679

(59 replies, posted in Database applications)

Hi Darek,
I had a look at your CSV file (obviously a flat file) and extracted the data into 3 related tables (films, nominations, categories).  I then took an old project and used it for your 'Film Oscars' application just to give you an idea of the sort of things that MVD can do (you don't even need a script - I just use it to automate a couple of the actions).
You can search for a film,  'click' on it to see any nominations and also search for nominees etc etc.  Most of the information I think you want to get using a status bar, I obtain using calculated fields - there are always different ways to do things with MVD.
The labels and headings are in english (sorry) but they're easy enough to change if you want to use any of the attached program.
Hope this gives you some ideas,
Derek.

1,680

(6 replies, posted in General)

Hi Manixs,
I suppose the 'correct' way would be to read through the images in a directory and load the file names into some sort of stringlist etc.
But if the number of images is fixed, I'd probably do it very simply as per the attached example (if you have a large number of images, use a batch utility to rename them 1.jpg, 2.jpg, 3.jpg ,4.jpg etc and then alter the script to however many images you have).
Derek

1,681

(11 replies, posted in General)

Hi Adam,
I'd probably do it something like the attached (using just one table for all transactions) to simplify the calculation of the running balance and showing all the transactions on just one grid. 
In my example, I've only shown the gross running balance and not the net because I'm not sure what fields count as additions and what count as subtractions and what your exact formulae should be.  But the logic is the same and the syntax is there for you to amend the calculated fields as suits your requirement..
Hope this helps,
Derek.

1,682

(11 replies, posted in General)

Hi Adam,
I'm rather confused as to what you're trying to achieve now.  Can you answer a couple of questions -
1.  Are you holding a starting balance against the account or is the starting balance the first entry in either the transactions or the journals tables?
2.  Why do you have separate fields for transaction date and transaction time on the transactions table  (the journal table uses 1 field (date/time)?
3.  Isn't a journal (positive or negative) just another transaction, in which case, why have 2 separate tables?
Question 3 is particularly important because if you split things over 2 tables, do you then want to see one running balance for journals and a second running balance for transactions - and if so, does the starting balance get included in the calculation for the journals running balance or for the transactions running balance (or both or neither)?  Surely you can only have 1 running balance.
Or do you want to see the running balance at any point in time using the starting balance + all of the activity from the journals table up to that point + all of the activity from the transactions table up to that point - so the running balance will always show the same whether you're looking at the 'journals' tablegrid or the 'transaction' tablegrid?   If so, I can imagine users constantly switching between the two trying to reconcile the amounts.
As always, I favour keeping things as simple as possible and, for what it's worth, I'd go with just two tables (account and transactions) and use transaction types of 'deposit', 'withdrawal', 'journal-in', 'journal out' and 'starting balance'.  Your transactions table will inevitably end up with fields that are relevant to only certain transaction types (but that's no different to how it is now with fields for withdrawals, for deposits etc) but at least it will be easier for everyone to work out what's going on..
Derek.

Hi,
If you have no success with cascade delete (which is the usual way to do it), then you can manually delete the document history records first and then the document master - see the attached amendment to your program when you click 'delete'. 
Obviously, the whole thing could be automated but I'm not sure it's a good thing to make it too easy for deletions.
If it were me, rather than physically delete a record (and lose the audit trail), I'd use a 'deleted' status (just like all your other statuses - received, printed, filed etc etc).  So select a 'deleted' status and it gets automatically added to the 'document history' with a date/time stamp.  You could then filter out your 'deleted' documents if you don't want your users to see them on Form1, but they'd still be held in the DB for audit purposes.
The other thing you'd need to consider are any attachments you might be holding in a 'copy to' folder (if I remember correctly, it's something you were asking about earlier).  If you were physically deleting the document master and document history, it will be leaving 'orphaned' documents in your 'copy to' folder so you'd either need to manually clear those out or delete them by script.
Derek.

Привет,
В варианте 1 я использовал SQLiteStudio для заполнения таблицы «статус» - так было быстрее.
В приложении приведен пример, поэтому вы можете ввести значения для таблицы «status».
С вариантом 2 не было никаких проблем, потому что статус изменяется в скрипте.
Derek.
.
Hello,
In Option 1,I used SQLiteStudio to populate the 'status' table - it was quicker to do it like that.
Attached is an example so you can enter the values for the 'status' table.
With Option 2 there was no problem because the status is changed within the script.

1,685

(3 replies, posted in General)

Hello Dmitry,
Really like the header alignment option with 5.4 Beta - this is going to be much quicker and easier now.
On the same topic, can I ask if you have plans to:
1)  specify the format of numeric columns (data rows and footer) using the object properties of the tablegrid rather than having to use script (for example, something like  ''$#,##0.00')?
2)  specify alternate shading of tablegrid rows as an object property?
3)  specify color of columns (and perhaps specify a different color of a cell in that column if the value of the cell is negative).
Thanks as always.
Regards,
Derek.

1,686

(11 replies, posted in General)

Hi Adam,
Form1.tgjournal should now be showing the running balance at the row level.  Form1.tgaccount shows the current balance as it did before.
You can enter journals for earlier dates (or same date but different times) than the most recent journal and the formula will automatically recalculate the running balance for each row.
Derek.

1,687

(11 replies, posted in General)

Hi,
A running balance calculation at the journal line level is, essentially, the total of all journal transactions (pluses - minuses) up to that date.  But since you don't have a date field on the journal table , I don't see how you can perform the calculation.
One other point  - do you really need a starting balance on the account table?  Why not make it the first entry in the journal table (with a description of 'starting balance');  it would simplify the calculated field and all of the information could be displayed in form1.tgjournal.  Just a thought.
Derek.

1,688

(3 replies, posted in General)

Hi All,
You could also try 'setfocusnextcontrol'.  Please see attached example.
Be careful if you have buttons on the form - I'd set their 'default' and 'tabstop' properties to 'false' otherwise 'enter' will be interpreted as a 'click'.
Regards,
Derek.

1,689

(11 replies, posted in General)

Hi Adam,
Try doing it like this (see attached)
Looking at the inputs, I was surprised that journal.amountloss isn't included in the calculation - I took a guess that it should be (but if not, just remove it from the calculated field formulae. 
I also assumed that the 'amountwin' in your post is journal.amount?
Your calculated field is called cfrunnigbalance (not cfrunningbalance) but I haven't changed it in case you're using it elsewhere.
Lastly, with calculated fields, you need to do tablegrid refreshes as soon as the underlying data has changed, so I added that to the script.
Everything seems to add up but I'm not really sure what I'm checking - LOL!
Regards,
Derek.

1,690

(2 replies, posted in General)

Hello,
Please see the attached example and screenshot1.
The button that has the 'default' property set to 'true' is the button that automatically gets clicked when the User presses 'Enter'.
Check that any other buttons on the form are set to 'false' otherwise it might not do what you want.
Regards,
Derek.

Привет Varlam,
Есть много способов сделать это. Я привожу 2 примера, которые могут помочь.
Пример 1 - обычный способ сделать это без сценария.
Пример 2 - с небольшим скриптом; щелкните столбец «Состояние» в любой таблице, чтобы изменить статус и переместить его между таблицами.
С Уважением,
Derek.
(с гугл переводчиком)
.
Hello Varlam,
There are many ways to do this.  I give 2 examples that might help.
Example 1 - the normal way of doing it with no script.
Example 2 - with a small script;  click on the 'Status' column in either tablegrid to change the status and move it between tablegrids.
Regards,
Derek.

1,692

(11 replies, posted in General)

Hi Eyeman and TC,
Rather than using a script to show the patient's name (first, middle and last), why don't you concatenate those fields in the drop-down list itself (see screenshot1 in attachment epl2);  this has a number of benefits.
1.  no script
2.  you can search the drop down list not only by PID, but also by any part of the name so picking the correct patient in the first place is much easier.
3.  the patient and all the details selected in the drop down list stays visible.
Please see attached (epl2) a simplified example of what you might do (you can also search within the drop down list by date of birth and the number of outpatient visits made).
I also attach an alternative version (epl1) which is a much more traditional approach (starting with the patient, then drilling down into the outpatient visits record);  doing it this way, you are forced to maintain the link between the patient and the outpatient visit which I believe is a much better approach (and much simpler), but maybe there is a business reason why you need to 'de-link' patient and outpatient visit.
Derek.

1,693

(7 replies, posted in General)

Hi EH,
Great spot (and my bad - LOL!).
I've just changed the calculated field formats to currency and now all the grids are displaying correctly again with the latest version.  Thanks for that.
On a related issue, it's good that you can now set the column alignment within the tablegrid settings - but why only for the rows and not for the header and footer?
If, for example, you want your columns right-aligned, I can't envisage a scenario where you wouldn't also want the headers and the footers to be right-aligned.  The tablegrid is so critical to almost all MVD apps and yet there are still some basic things that need to be scripted.
Maybe it's something that Dmitry can provide.
Regards,
Derek.

1,694

(7 replies, posted in General)

Hi Adam,
What version of MVD are you using?
I've noticed formatting problems with 5.4 so have switched back to 5.1 for the time being. 
You can probably get round it by re-writing the script but I don't think that's really the way to solve version compatibility issues.
Derek.

Hi,
The 'hotspots' should work irrespective of whether your document locations point to the original location or point to the 'copyto' location.
It's generally not such a good idea to use 'storefile' for your documents, photos etc as the size of your application can quickly get very large.  I normally select 'linkfile' and choose a 'copyto' location so that all the documents which may have come from any number of places all end up saved to a single location;  an 'attachments' folder within the MVD app folder is fine but it could be any location (specific machine, LAN or WAN).
If you want your attachments to be seen by all users, then the folder they are saved in needs to be shared;  just sharing the sqlite.db is not enough when you use 'linkfile' for your attachments - the database points the users to the linked file but if that location isn't shared, they won't be able to see anything (if you were to use 'storefile' this wouldn't be an issue because the actual attachment is part of the database, not just a pointer).
I've changed your app so that it now hotspots on Column 2 (Doc Title), Column 7 (Attachment 1), Column12 (to see the Document Flow History) and Column 13 (Attachment 2 (Signed Doc).  It's a useful trick when using multiple hotspots to just put an '*' in the Column Heading in the tablegrid to remind users about the feature.
A couple of other things.  Your Attachment2 wasn't working because you weren't saving it (Form2 Button4).  Also, you might want to define Attachment 1 and Attachment 2 in your database as 'file' rather than 'image';  as it is, they can't be .txt, .doc etc file types (I just find using 'file' is less restrictive, but it might not be an issue for you).
Hopefully, it's all working okay now.
Derek.

Hi,
I think the problem might be the 'datein' field, originally defined as 'date/time' - when you change it to 'date' the code works fine and overdue items are coloured red.
Also, remember that when you are writing scripts that reference specific columns, columns (and rows) start at 0, not 1.  So you needed to change your [2,i].color to [1,i].color etc etc because you moved the 'datetin' column.  Also, your 'hotspot' columns needed to change because you'd added a new column.
You could also  colour the days overdue column - that way you can easily see whether an item was late processed irrespective of whether it has now been filed, printed or 'for dissemination'.  Just a thought.
Derek.

1,697

(3 replies, posted in General)

Hi Manix,
Is this the sort of thing that you want? (just move the mouse to the left hand side of the screen).
I do this quite a lot when I need the space and don't want to clutter up the form with lots of buttons.
Derek.

1,698

(3 replies, posted in General)

LOL -  I reckon your money's safe!
Just checked and realised that I'd forgotten to switch the tablegrid colouring back on - here's the corrected version if you need it.
Derek.

Hi,
Have a look at the attached example and the enclosed screenshot.
I have shown 2 ways of doing what I believe you want.
Option 1 uses a small script to retrieve a product description based on a Part No' that you select from a combobox.
Option 2 does not require any code, you just put the fields you want (Part No' and Description) into the combobox.  This also has the advantage that you can then search by entering some of the Part No' or some of the Description, so it is much more flexible.
Derek.

1,700

(2 replies, posted in General)

Hi,
If it's more 'planned' preventative maintenance rather than 'predictive' maintenance, then you could try approaching it something like the attached, which may give you some ideas.
Derek.