1 (edited by tcoton 2015-12-01 16:13:19)

Topic: Trigger action on combobox

Hi everyone,

I have a serious issue trying to figure out how to set a trigger like action within MVDB.

To simplify it, let's say I have 3 tables with 3 column each, except Status


Users                                                       |        Phone                                                             |   Status
------------------------------------                   --------------------------------------                                   ------------------
id  |  Name   |  id_Phone                          |   id   |  Number | id_status                                      |  id  | Status
-------------------------------------                  ----------------------------------------                                 ------------------
1   | Name1  |   1                                      | 1      | 1234567 |    2                                               |  1   | Not used
2   | Name2  |   4                                      | 2      | 9876543 |    1                                               | 2   | Used
                                                                 | 3      | 7854129 |    1               
                                                                 | 4      | 1745823  |    2               




Using a simple form, I want to display the following information on the action show record:

Name  in a textbox        |      Number in a combobox              |         Status in a textbox


When the record shows, I want to display current SQLValue.

When I click on the combobox to change the number, I want to display in the list only the number with id_status<>2


Here comes the tricky part:

I do not change anything, I want to see current Number back.

If I change the number, I want the old number to get id_status = 1 and the newly chosen one to get id_status = 2

So far I could manage to display a filtered list of available number when opening the combobox but if do not chose a number, the combo becomes blank. If I choose a number, I have to update 2 status manually.


I am really open to any suggestion, idea, trick, tips....


Attached a quick and dirty example with no dll or exe.

Post's attachments

Attachment icon Combo_trigger.zip 4.95 kb, 487 downloads since 2015-12-01 

Re: Trigger action on combobox

Please check out this project:

Post's attachments

Attachment icon Combo_trigger_fixed.zip 6.15 kb, 596 downloads since 2015-12-01 

Dmitry.

Re: Trigger action on combobox

You rock Dmitry!! Thank you very much.

There is still a minor bug when just deploying the list with no action, the combo becomes blank but comes back with current value if record is re-opened later.

This is off an higher level. Thanks for teaching this.

Would it be possible to get more documentation about the implemented procedure within MVDB? I could not find the PopulateComboBox procedure in current online help.

Re: Trigger action on combobox

PopulateComboBox is just name of procedure, you can rename it to any name, you can write any procedures and then call them from event or even from others procedures.

Dmitry.

5 (edited by tcoton 2015-12-02 13:17:48)

Re: Trigger action on combobox

I feel dumb suddenly but I was referring to what follows the procedure name with which I and most of new users are not familiar with:(ComboBox: TdbComboBox; ShowNotUsed: boolean);

smile

And is the calculated field required? I cannot see a query to it

Re: Trigger action on combobox

You can delete calculated field from the project, not using in the project.

Dmitry.

Re: Trigger action on combobox

Ok, thanks.