How to change data provider and valuelist programatically

Hi all.

I do not know how to get this done. Let me first explain the problem.

I have a table, let´s say Orders, that has two field customerID and subcustomerID. That is because some customers have subcustomers, indicated in the table customer by a flag “hasSubCustomers”. That way some records in the Orders table have customerID filled and some others have customerID and subcustomerID. At the same time there are two tables, one for the customers and another for the subcustomers.

Now I have a form, TableView, that shows the Orders and I want to show the name of the customer when subcustomerID is null and the name of the subcustomer when it has a value.

I have been thinking about the onRender event and changing the dataProvider and valueList properties of the label, but I can not change those properties at runtime, or at least I´m not able to get it done.

Any other idea to get this done?

Thanks in advance.

Sounds like you should use an unstored calculation for that, that checks the value of “hasSubCustomers” and based on it returns the customerName or subCustomerName.

This doesn’t sound like a job for the onRender event (new in Servoy 6) at all, as that is about rendering the UI, thus about the appearance of the UI (elements).

Paul