2,026

(2 replies, posted in Script)

Hi,
Please see attached.
Derek.

Здравствуй
Я бы сделал это таким образом, но, возможно, есть лучшие способы
С Уважением,
Дерек.

2,028

(4 replies, posted in Russian)

Hello,
не меняя структуру? - Я думаю, что я бы использовал sqlquery вместо скрипта
Попробуй это.
Derek

Здравствуйте
Возможно, не совсем так, но вы можете скопировать существующие данные в новую запись, подобную этой.
Он не очень сложный, но он прост и работает!
Derek.

2,030

(4 replies, posted in Russian)

Hi pt.82
Возможно, с calculated field.
Попробуй это
Derek.

2,031

(5 replies, posted in Script)

Hi Jean, Hi Mathias,
I didn't see your post so I'm not sure if you are still looking for ideas.
I too wrote a small music management app a while ago.  Its data structure is very simple -  a table for artists, a table for CDs, a table for tracks, with the obvious relationships between the 3.
Although the data structure is 'top to bottom' hierarchical (ie search from the artist down to CD down to track), I also wanted to be able to select by track and have it search back up the hierarchy - and also select by CD and have it search both up and down the hierarchy (I hope that makes sense!).
It also needed to display tracks alphabetically when searching by artist but sort by track number once a CD has been selected.
However, it doesn't try to calculate the duration of a CD (it wasn't a requirement) but I may 'steal' Mathias' script and update my program!
Anyway, I have attached it and maybe it will be of some help (the data was just for testing purposes - it's not my 'true' tastes in music - honest!!)
Regards,
Derek.

2,032

(3 replies, posted in Script)

Hi,
Does the attached help?
Regards,
Derek.

Hi Krugge,
Нет необходимости в другой таблице. В MVD вы используете рассчитанные поля.
Посмотрите пример и скриншот.
Derek.

Hello Adiziktdy,
возможно, так
Derek.

2,035

(3 replies, posted in General)

Hi V_pozidis,
This is the way that I read and write .txt files into and out of MVDB but there may be other ways too.
In my example, I hard code the name and location of the .txt file but you could also prompt for name and location if that is what you need.
Hope this helps,
Derek.

Здравствуйте Baston, Bonsoir Jean,
Попробуйте это так.
надеюсь, это поможет.
Regards,
Derek.

2,037

(6 replies, posted in Russian)

Здравствуйте,
Может быть, так? (нажмите сочетание клавиш CTRL + tablegrid)
Дерек

2,038

(1 replies, posted in General)

Hi v_pozidis,
Here is one quite easy way to check for unique records with a couple of lines of script (see attachment), but there are other ways too.
Please let me know if there is anything that you don't understand.
Regards,
Derek.

2,039

(3 replies, posted in General)

Hi David,
I'm not sure from your post if you're using discrete search boxes for each field that you want to search on. 
If so, you might consider concatenating all (or a sub-set) of the searchable fields into one calculated field and just search on that instead (obviously, using '%s%' is fundamental to this). 
It's not just about reducing the number of search boxes to make it simpler, or the form neater - there are 'usability' reasons why you might choose to do it this way. 
Consider the question:  "did the user choose 'photography' from the 1st, 2nd or 3rd combobox, or type it into one of the 2 free-form fields?'  - that's 5 separate searches to find where 'photography' could have been entered.  This is reduced to 1 search using a concatenated search field - so happy users (well, at least for a few minutes!!).
Have a look at the attached - in this instance, I've combined 'name', 3 comboboxes containing 'main hobbies' and 2 free-form fields containing 'other hobbies' but obviously you can mix and match anything to suit your application.
Maybe this gives you some ideas.
Regards,
Derek.

2,040

(2 replies, posted in General)

Hi v_pozidis,
You could probably use calculated fields;  please see attached.
However, if it were me, I would structure my data in a different way;  for example, use just one table for 'person' and 'work' and use a flag ('p' or 'w') to indicate which the row was.  Then you can simply filter the grid by 'flag' to show 'persons' or 'work' rather than needing to create separate forms.
Regards,
Derek.

Hi Adam,
I think I'd just leave the calculated fields as they are and do the formatting in the script - something like
tnxnumbercolumn(form1.tablegrid1.Columns[1]).formatmask := '#,###,##0.00'; 
Please see the attached.
Derek.

Hi Adam,
The 'vname: string' was just a local variable that got included in some copy/paste I was doing - it's not needed.  It's just the 'doonchange' that's required.
How exactly are you wanting the calculated fields to display in the grid (ie left or right justified, how many decimal places etc) because you can do a fair amount with 'printf' when you define your calculated fields?
Derek.

Здравствуйте,
попробуй это:
Form1.pagecontrol1.ActivePageIndex := 0;   
Derek.

Hi Adam,
I'm a great believer in making life easy for myself (LOL!) so I'd simply use the standard 'parentcombobox' functionality.
This normally works without any script.  However, because you are passing the supplier through from frmpurchinv to frmpurchinvitem by script rather than manually entering it on frmpurchinvitem, you need to add a 'doonchange' line (it's in the attachment).
Hope this helps,
Derek.

Hi Adam,
There were a few things that I changed.
1.  you were using tgmainproducts instead of tgmainsuppliers to display products belonging to a selected supplier.
2.  you were holding qty, id_product and unitprice on your purchinv table which doesn't make sense to me - these are things that you'd store at the purchinvitem level;  if you have an invoice with 5 lines of different products, what does 'qty' mean, which of the 5 id_products are you going to hold etc etc?  Alternatively, if your application only allows for single line invoicing, then there is no point to having both a purchinv and a purchinvitem table.
3.  added calculated fields to hold net values (as they can all be derived from source data (qty and unit price)) rather than doing it by script.
I haven't changed it but I'd consider using some sort of relational lookup on the purchinvitem form otherwise you can easily be selecting products that haven't been set up for the supplier that you're invoicing - with all of the knock-on problems that will cause.
Derek

2,046

(12 replies, posted in General)

Hi Wen,
Please have a look at the attached.
Hope this helps,
Regards,
Derek.

2,047

(4 replies, posted in General)

Hi Den,
Earlier, I was trying to run your project with a different version of MVD which was why I was getting an error message - all good now.
On Point 2, the easiest option might be to simply prevent the user from entering exam grades until the student record has been added;  it can get rather complicated otherwise. 
In my attachment, as an example I have set the pagecontrol to disabled in the object properties and only switch it to enabled once the student record has been created.  Additionally, there is a panel/message to explain to the user why they can't enter exam grades at that time.
But there are lots of other ways to to this and another method may be more suitable for your project / users.
Derek.

2,048

(12 replies, posted in General)

Hi Wen,
I guessed that you'd want to not show countries that have not registered a person - LOL!
        if (ValidInt(cfcountryValue)) and (cfcountryvalue > '0') then ChartPie.Series[0].AddY(StrToInt(cfcountryValue),countryvalue);
Please see attachment and hope it helps
Regards,
Derek.

2,049

(4 replies, posted in General)

Hello Wen,
I tried to look at your Students project but had trouble getting past the 'login' screen (it returns an error in the script).
However, I put this to one side and looked at Question 3. in your message.
Place a label on top of each 'point.png' and set the label's 'transparent' object property to true.
Then calculate the number of students for each province in your script - I have added a few details so there is some data to look at.  This is on the frmmain_onshow event at the moment.
I hope this helps a bit.
Regards,
Derek.

2,050

(4 replies, posted in General)

Hi David, Salut Mathias,
Just a thought, but there are a couple of reasons why you might want to filter the 'invoiced' status using a combobox instead of a checkbox (make sure the 'first item empty' property is set to 'true' (the default) which is the equivalent of the checkbox's 'allow grayed').
1.  if you are already using comboboxes for 'job status' and 'customer', the user might find it more consistent rather than a mix of comboboxes and checkboxes.
2.  checkbox only ever allows for 3 conditions (in your example, 'not invoiced', 'invoiced' or either).  What if you have other conditions (eg 'part invoiced', 'queried invoice' etc)?  This may not be relevant for you at the moment but might 'future proof' your application if the requirement changes at some point (as they always do - LOL!).
If the preferred option is 'not invoiced' then (as in the attached example from Mathias), set the default index for the combobox to be '1' on both Form1 and FrmEmployee.
Regards,
Derek.