Hello Rufmersamlabag,  Hello Dmitry,
Attached is an old project of mine that I have made a quick couple of changes to.
Would this be of any help to you?
Regards,
Derek.

1,952

(7 replies, posted in General)

Hi There,

In a script, you could use something like this:

procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
  openfile('C:\Documents and Settings\user\Desktop\blackpearl\red\red.exe');       //*** calls another MVD program (called red.exe)
end;

procedure Form1_Button2_OnClick (Sender: TObject; var Cancel: boolean);   
begin
  openfile('notepad.exe');                                                                                    //*** calls notepad.exe (no file specified)
end;

procedure Form1_Button3_OnClick (Sender: TObject; var Cancel: boolean);   
begin
  openurl('www.myvisualdatabase.com');                                                        //*** calls the specified website using your default browser
end;

begin
end.

Regards,
Derek.

1,953

(10 replies, posted in General)

Hi Nitin, Dmitry,
Just for information, I have tried it all the way back to Version 3.5 and I still don't get any error message either.
Derek.

1,954

(4 replies, posted in Script)

Hi Alex,
Have a look at the attached which does most of the things you mentioned (well, it should but I've not really tested it!).
There are 2 basic ways of approaching it - using a single table (which I've done because it was quicker) or using a second, related table which would hold details for each cycle of depreciation for each asset - it's probably the way to go if I were doing it 'for real'.
Each asset is set up with a purchase date, purchase price, depreciation rate and number of days between depreciation cycles.  After that, the main grid shows in red assets that are due to be depreciated and, when you select one, the 'depreciate' button is visible.  Click it and it automatically calculates the depreciation and deducts it from the asset book value.  It also calculates when the following depreciation date is due.
Once depreciation starts, I 'lock' some of the asset details (ie price, rate, date etc) otherwise it would invalidate depreciation that has already occurred.
Anyway, I'm sure you'll get the picture and hope you can use some of it in whatever project you have in mind.
Regards,
Derek.

1,955

(1 replies, posted in FAQ)

Hi,
I think the syntax for your calculated field should be
(
select sum(qty) from ininfo where prdinfo.id = ininfo.id_prdinfo)
)
Also, you don't need id_ininfo in the prdinfo table (I imagine it's just a one-way relationship).
Regards,
Derek.

1,956

(4 replies, posted in Script)

Hi,
Please see attached (using your example, there are some assets and when they are more than 365 days old, the option to enter disposal details becomes available).  I've hard coded it for 365 days but it's just as easy to make that dependent on the record itself (in your example, some assets might be disposed of after 1 years, some after 3 etc etc).
Obviously, it doesn't have to be a button that's enabled - it can be ANY object that can be placed on a form or, indeed, ANY property of that object (the one that is probably used more than any other is setting a cell's colour in a tablegrid depending on elapsed date, value threshold etc). 
Regards,
Derek.

Hello Metatron,
Надеюсь, я понял ваш вопрос (я использую переводчик Google!).
Пожалуйста, взгляните на приложение, которое делает некоторые из вещей, о которых вы спрашиваете, - оно основано на моем старом проекте. Я использовал даты начала и окончания, а также создал таблицу для «сдвигов». Кажется, лучший способ проверить все возможности.
Надеюсь, это поможет,
Regards,
Derek.

Привет, Михаил,
Возможно, попробуйте это так.
Надеюсь это поможет,
Derek.

Здравствуйте,
Установите свойство fixedcols таблицы tablegrid на «1» (или «2» и т. Д.).
См. Прилагаемый скриншот.
Derek.

Hello Mikhail,
Посмотрите пример и на скриншот (mikhail panel.jpg).
Если вы поместите все свои поля на панель, вам нужно только включить / отключить панель.
Я использовал другой цвет для панели, чтобы вы могли ее легко увидеть, но обычно это тот же цвет, что и фон формы (чтобы сделать его невидимым).
Надеюсь, это имеет смысл (с помощью Google Translator).
Regards,
Derek.

1,961

(31 replies, posted in Russian)

Hello Scopus,
Возможно, попробуйте это так
Form1.GridEmployees.dbitemid := last_insert_id;  // select new record in TableGrid
Regards,
Derek.

1,962

(4 replies, posted in General)

You're welcome.
Just a thought, but if you want to colour code the text rather than the background, you might want to switch bold on as well, otherwise it can look a bit washed-out!
If you do, add to the script  -  form1.tablegrid1.cell[1,vi].fontstyle := fsbold;
Regards,
Derek.

1,963

(4 replies, posted in General)

Hi David,
How's things in your corner of the world?
Have a look at the attached as a way of colour coding according to elapsed days (I've only done it for 3 days worth but you'll get the general idea).
If it's the actual text you want colouring rather than the cell background, simply replace .color with .textcolor in the script.
Hope this helps,
Regards,
Derek.

Hello Mikhail,
Я не считаю, что это важно, где находится идентификатор.
См. Прилагаемый пример.
С Уважением,
Derek.

Здравствуйте Mikhail,
В конце инструкции select sqlquery вы должны включить идентификатор записи.
Например:
select
person.firstname,
person.lastname,
person.id

from person

where.......

Возможно, это проблема.
Regards,
Derek.

Hello,
Вы можете использовать тот же tablegrid.
Чтобы сбросить таблицу после поиска, просто снимите критерии поиска.
Посмотрите прилагаемый пример.
Regards,
Derek.

1,967

(5 replies, posted in Script)

Hi There,
A couple of things to point out, if you don't mind;
1.   I think it would be better to display a picture based on a value from a combobox rather than from an edit field (if the user types in something incorrectly, for example, the picture won't show).
2.  perhaps not too relevant in your example, but hard coding it into the script means that if a new option is used (for example, a bakery) then this won't get selected unless the developer adds it into the script).
Attached is a small example of how I might approach it which 'future-proofs' you against any additions/changes to shop type;  hopefully it can give you some ideas.
Regards,
Derek.

Hello
Возможно, вы можете сделать это так?
Derek.

Datagrid может отображать данные из одной таблицы или из многих связанных таблиц; это не имеет значения, потому что моя сохраненная последовательность сортировки использует номер автоинкремента самого datagrid - он не зависит от каких-либо таблиц.
В этом примере я оставил 2 столбца видимыми, чтобы вы могли видеть, что происходит. При первом запуске программы столбец «old sort order» и столбец «new sort order» всегда будут одинаковыми. Когда вы впоследствии меняете порядок сортировки, столбец «new sort order» никогда не изменяется, и это порядок сортировки, чем он сохраняется при закрытии программы.
И убедитесь, что последовательность сортировки, указанная в свойствах объекта datagrid, установлена в столбец «new sort order», иначе он не будет работать
Извините, если это неясно - с помощью переводчика Google.
Дерек

Здравствуй,
Возможно, вы могли бы попробовать это так.
С уважением,
Derek.

1,971

(4 replies, posted in Script)

Hi Alex,
This probably isn't 100% what you're looking for but I guess you can take the script and tweak it to do more closely what you want.  At least it might give you some more ideas of how to approach the problem. 
It's a bit rough and ready as I'm rushing - so there's not much by way of test data in it and I've not checked that every thing works exactly as it should.
Hope this helps,
Derek.

1,972

(4 replies, posted in Script)

Hi There,
I'm not sure I understand the requirement properly.
For each respondent, you need to know
1.  respondent identifier (presumably anonymous - (counter?)
2.  Question 1 - what state they reside in (combobox with a list of states)
3.  Question 2 - what sex they are (combobox with a choice of genders)
But Queston 3 is where I start to get confused;
If marijuana, alcohol, crack and ecstasy are checkboxes, they can only contain responses of 'yes' or 'no'.  So where does your combobox with values of 'yes', 'no' and 'maybe' fit in?  Perhaps you could explain Question 3 in a bit more detail?
Thanks,
Derek.

1,973

(1 replies, posted in General)

Hi Everyone,
I had to write an app recently using treeview functionality and the user wanted to be able to re-sort the tree so I knocked up a script to do this (it's pretty basic but it seems to work!). 
Maybe it can help some of you who have asked about this topic in the Forum.
I can't say for certain if it works for every scenario and my app only uses one table but I imagine the general principle should still be valid. 
If it's of any use to anyone, please feel free to copy it, change it, improve on it etc.
I've left a bit of test data in it which means it's too large for here but it can be downloaded from this link
https://app.box.com/s/xozrjtjku8z21grc0x0n8433vidzbbxl
Regards,
Derek.

1,974

(4 replies, posted in Script)

Hi Kees,
Attached is the way that I've always formatted columns (and footers and headers).  I'm sure it's not the only way but it's always worked for me (so it's what I stick with!).
A couple of things to mention;
1.  in the tablegrid,  columns start at 0 rather than 1 so vergoeding is actually column3 in your example.
2.  you hadn't actually associated the tablegrid1 'onchange' event with the code in the script.
And apologies but I don't have a 'euro' symbol on my keyboard so you'll have to make do with £ - LOL! (just replace £ in the tablegrid properties( footer settings) and in the script).
Anything not clear, then just drop a message.
Regards,
Derek.

Здравствуйте,
Думаю, я бы использовал рассчитанное поле. Вот пример.
Надеюсь, это поможет.
С Уважением,
Derek