1

(8 replies, posted in General)

I was aware of this. 
My approach was to keep it as simple as possible and as Form3.TableGrid1 will (as per Identity's message) only contain 2 values (Elementary and High School), it didn't seem worth adding a script for something that has such low volatility and is unlikely to change once it has been set up.
Ultimately, it is Identity's choice.

2

(8 replies, posted in General)

Hi Identity,
I think the easiest option (no script) is to go with Jean's suggestion.
1.  use a combobox to select which type of teacher and school (Elementary or High School)
2.  use parent comboboxes to restrict which teachers and which schools are shown.
Derek.

3

(26 replies, posted in General)

Hi Igor,
This is the correct behaviour.
If you try to delete a record that is being used elsewhere, it will compromise the integrity of the database and created ''orphan'' records.
And if you select ''cascade/delete'', then the database will attempt to remove all the records where the record you are trying to delete is being used after which it can perform the deletion.
Referring to your project, I wonder if what you are trying to do is prevent records in the 'services' table being used once the 'pricedate' has expired?  If this is the case, there are other ways to achieve this.
Have a look at the attachment for a couple of options - I have simply added a 'flag' to indicate when a service/item is no longer current and then added a filter to various comboboxes to prevent that record from being used in the future (I also set the price in the 'services' table to 0.00).  Doing it this way means that you can still re-create old orders, old invoices etc that refer to services/items that have expired in the meantime.
Another way (not in the attachment) would be to validate the selection (using a script) and display appropriate error messages (but I think it's better to try and prevent it from happening in the first place).
Regards,
Derek.

4

(8 replies, posted in General)

Hi,
All you need to do is add filters to the 'teachers' combobox on Form2 (please have a look at the attachment).
Be aware that the filter values are case sensitive (ie 'High School teacher' will work  but 'high school teacher' will not).
Regards,
Derek.

5

(26 replies, posted in General)

Hi Igor,
10,000 records is not too many (although the PC you run it on will obviously be a factor).
You have previously stated that each order will produce an invoice (one for one);  therefore if you have separate tables for orders and invoices, then you will ultimately have 2 tables, each with 10,000 records which has to be less efficient than holding all your transactions in a single table with 10,000 records.
Obviously you will be adding more tables as you develop your application further but these will be for related data rather than to hold actual transactions.
What can affect the performance is using a lot of calculated fields (very useful depending on the requirement but will probably slow your application down). 
So I would look to replace calculated fields where possible (see attachment which is a re-working of an earlier example with the calculated fields removed).
Regards,
Derek.

6

(8 replies, posted in General)

Salut Identity, Jean,
Ça va les Deux?
Another option is to use 'user authorisations'.
Have a look at the attachment.
The passwords are 'admin', 'Identity' and 'Derek'
Derek can only see 'Elementary Schools'
Identity can see 'Nursery Schools' and 'High School'
Neither Derek nor Identity can see the button to access users (this is only visible and available to Admin).
Derek and Identity get a warning message and cannot access the 'set up' option which shows as disabled.
There are many combinations you can use so it is very flexible and your existing project shouldn't need to have any changes.
Apologies that the data makes little sense (I just quickly changed an old project) but I hope it shows you another possibility.
As a side issue, 20 tables seems quite high;  maybe your data schema could be rationalised (although without seeing your project, it's hard to be certain).
Regards,
Derek.

7

(2 replies, posted in General)

Hi Igor,
Have a look at the attachment as an option to get round this  (thanks to Sparrow for the original suggestion from a looooong time ago! smile)
Derek.

8

(26 replies, posted in General)

Hi Igor,
Thanks for your example project - it helps to understand what you are trying to do.
Since you explained that, for your requirement, you always make one order which then becomes one invoice (a strict 'one for one'), I wonder if you even need to have separate tables for orders and invoices - I think it can be simplified much more.
In the attached example, I suggest the following.
1.  You have a table for 'transactions' (don't think in terms of an 'orders' table or an 'invoices' table at all).
2.  The 'transaction' is given an automatically generated reference (record_count)
3.  Each 'transaction' simply moves from one stage to another - it starts off as an 'order', it then moves to a 'delivery', it then moves to an 'invoice' and finally it moves to a 'payment'.
4.  You indicate that the 'transaction' has moved from one stage to the next stage simply by ticking the relevant datetimepicker (order date, delivery date etc etc).  It's very quick and involves no additional input.
5.  As it moves from one stage to the next, a reference is automatically generated (based on the 'transaction reference') to indicate the stage that it has reached (for example O-00012 for an Order, D-00012 for a delivery, I-00012 for an invoice etc).
6.  Additionally a 'status' flag is added ('Ordered', 'Delivered' etc) and this 'status' flag can be used in searches.
I appreciate that your requirement has many more features that you want to add later on but I wonder if this could be the basis from which you can start and build upon.
Apologies for using my own application template (it just means I can create something very easily and quickly) but if the approach in the attachment is useful, you can just copy over the ideas / code etc)
Regards,
Derek.

9

(26 replies, posted in General)

The program works that way because
1.  it allows for the possibility of more than 1 invoice per order (for example, if you have an order with 20 lines, 10 lines might be on Invoice 1, 6 lines on Invoice 2 and 4 lines on Invoice 3.
2.  it allows for the possibility of more than 1 order appearing on the same invoices (for example, Invoice 4 can refer to parts (or all) of Orders A, B and C.
Are you saying that there each entire order is only ever invoiced on a single invoice (and that each invoice is only ever for a single order)? 
If so, the whole approach can be simplified.
Derek.

10

(5 replies, posted in General)

Hi,
I'm not sure I understand 100% what you need but hopefully the suggestion in the attachment helps.
I have added a new form ('FormDerek') just as a demonstration.
1.  Double click on the 'Name' column will take you to 'FrmEditClients'
2.  Double click on the 'TK Policy' column will take you to 'Yest'
3.  Double click on the 'Endorsment ID' column will take you to 'FrmEndorsment'
(nb.  these columns are shown with an '*' against the column heading in the tablegrid to make it easy for your users to see which columns are interactive).
The code is Lines 8-16 in the script.
Just delete 'FormDerek' when you are finished with it.
I did not know the password so I've removed 'user authorisation'  but you can simply add this again.
Regards,
Derek.

11

(5 replies, posted in General)

You can upload your project by deleting the .exe file and then attaching the application folder as a .zip file.
Alternatively, create a quick application that demonstrates the issue that you are trying to fix.
Derek.

12

(3 replies, posted in General)

Hi
Can you attach an example of your project.
Derek.

13

(4 replies, posted in General)

Salut Sabine,
Maybe try something like this - please see attached.
Regards,
Derek.

14

(26 replies, posted in General)

Hi Igor,
Have a look at the attachment which, I believe, does the basics of what you need your application to do.  As mentioned earlier, if this is working, then you can add extra features later on.
The example allows
1.  clients can have multiple orders
2.  clients can have multiple invoices
3.  orders / invoices can have multiple order / invoice lines
4.  orders / invoices can initially be created with no lines if that is a requirement
5.  order lines can be partially invoiced
6.  order lines from different orders can appear on the same invoice
If your requirement was only for one order line = one invoice line, the data schema would be more straightforward but I don't know if that's the case.
Regards,
Derek.

Hi,
Have a look at the attachment as an example.
First generate a range of dates on 'FormSetUp' - it can be for any length of time and doesn't have to be for a specific month.
Then on Form1, simply use the 'From' and 'To' date range to display your work schedule form (doing it this way gives you more flexibility as you could have weekly, monthly, annual schedules etc - or for whatever range of dates you require).
However, if you only ever need a ''month'' work schedule, you could simply replace the ''from'' and ''to'' date filters with a single date filter formatted as ''month/year''.
If anything is not clear, just shout.
Regards,
Derek.

16

(4 replies, posted in Reports)

Hi Fmr, Hi Sparrow,
Your relationship is the wrong way round;  the relationship needs to be created on the ''footer'' table pointing back to the ''header'' table.
With very few exceptions, the relationship is always held on the table that contains one or more records that ''belong' to a single record in the other table
A simple example would be a database with two tables - ''customer'' and ''invoice''.   A customer can have many invoices but an invoice can only ever belong to a single customer (so the relationship is created on the ''invoice'' table linking it back to the ''customer'' table.
And so in your example, a ''header'' record can have many items in the ''footer'' table so the relationship is created in the 'footer'' table to link back to the ''header'' table.
Derek.

Привет,
Если я правильно понял ваш вопрос, код для вашего вычисляемого поля как во вложении.
Также убедитесь, что вы создали правильную связь между вашими таблицами.
С уважением,
Derek.

18

(6 replies, posted in General)

Hi Jeff,
A couple of approaches you could take but I've kept it pretty simple in the attached example (so rather than using a checkbox and looping through a tablegrid, it works one row at a time as soon as the row is clicked (there's less script and actually slightly less 'clicks' doing it this way too!)).
But irrespective of how you work it, your old data structure was incorrect - you can't simply add records from the 'items' table to the 'clients' table because you don't know how many items the client is going to be associated with (1, 3, 100 etc?) so where are you going to store them?  That's one of the main reasons for using a relational database.
In your case, you need to create a new table ('clientitems' in the attachment) that holds relationships to both the 'clients' table and the 'items' table.  The 'clientitems' table is maintained via the script (look for the 'sqlexecute insert' and 'sqlexecute delete' lines - the rest of the script is just a bit of duplicate record checking and cosmetic stuff to make it a bit more user friendly).
Shout if anything's not clear.
Regards,
Derek.

19

(26 replies, posted in General)

Hi Igor,
The error message is because you have not created a relationship between the 'customer' and 'invoice' tables.
You also need to populate 'FormUnosNovogNaloga.ComboBox1' (line 11 in the script).
This will fix the error that you are getting.
However, there are a lot of other things that are not correct with your project.
As I understand it, your project should, at its most basic
1. add / edit / delete customers
2. add / edit / delete an order for a customer;  this order can have one or more order line
3. add / edit / delete an invoice for one or more order lines that have been delivered to a customer.
As I have mentioned before in earlier posts, until you have this basic functionality working correctly, you should forget about features like coloring grid lines, product images, messages, database backups etc etc;  they can all be added later.
I would also strongly suggest you rewrite - at the very least - FormUnosNovogNaloga and use two separate forms instead (one for orders and one for invoices).
Derek.

20

(6 replies, posted in General)

Hi,
A couple of options to have a go at (see the attachment for a couple).
The first example uses a checkbox to filter the data (just check random rows of data and then click the 'filter by checkbox').  When you're finished working on the list of filtered rows, just click the 'filter by checkbox' again.
The second example takes a different approach (and doesn't actually use a checkbox but uses arrow indicators as being a bit more intuitive for the end-user).
There are other options as well - probably a case of picking the one that best suits your project and/or your users.
Derek.

21

(6 replies, posted in General)

Hi Jeff,
1.
The 'auto number' option simply adds a column to the tablegrid so you can easily identify where you are (ie "I'm on row 67");  basically, it's just a sequence number. 
Note that when you resort the tablegrid, the auto numbers don't get re-sorted - that's the whole point.
2.
The 'checkbox' option allows you to select random rows from the tablegrid that you might then want to perform some sort of action on ('filter' by rows that have been 'checked', export 'checked' rows to Excel etc etc or, as in the attached example, you use the checkbox to select all the rows that you want to copy into a Bill of Materials).
Be aware that neither the 'auto number' nor the 'checkbox' forms any part of the actual data structure so you won't see them if you examine the data using SQLite or something like that - they're just temporary while the program is running.
If anything's not clear, just shout.
Derek.

22

(7 replies, posted in General)

Hi Adam,
If you use Form2 with borderstyle = none and position Form2 appropriately over Form1, I'm not sure where there is much complexity.  I appreciate that it's not strictly using Form1 for adding/editing nodes on the tree but the end result is, as far as I can tell, the same.
Attached is an amendment to the earlier example with everything but the basic functionality stripped out.
Derek.

23

(7 replies, posted in General)

Hi Adam, Sparrow,
Perhaps you could try doing it something like the attached (in other words - cheat!  big_smile)
Maybe it gives you a few ideas.
Derek.

24

(26 replies, posted in General)

Hi
I am unable to replicate your error.
You need to attach the latest version of your project and explain the exact actions you take up to the point that you get the error.
Also, was it working before and you changed something or has it always given this error.
The more information you can give, the better any help that you receive will be - otherwise it's not much more that guessing.
Derek.

25

(3 replies, posted in Russian)

Привет,
«DATEDIFF» нельзя использовать как часть вычисляемого поля.
Попробуйте это

abs(julianday('now') - julianday(out_date)) 

Вы можете изменить расчет в зависимости от того, хотите ли вы включить или исключить сегодняшнюю дату.
Derek.