Hello, I am trying to let the user choose which fields he wants to have on a form (in a certain area). For example, one user wants to see the total sales, another wants to see the birthday.
I think I have done that before, but see no way right now. The idea is to let the user store up to e.g. 5 field names in his preferences and those five fields are then populated with the data of the fields that the user chose.
Let’s say you have 3 fields “name”, “street”, “city”. In a user table you have a field “field_choice_1”. In that field the user chooses “street”. I now want to be able to display the content of the column “street” in a field. The problem is, that I have no option to dynamically set the dataprovider of a field.
First I tried with [field_choice_1] and was trying to get Servoy to display the contents of the field “street”.
Since that didn’t worked, I made a self-relation on my table from pk to pk. Then I tried with self-relation[field_choice_1] and now am able to see the field contents based on what the user chose to see.
My question was: what is the difference between [field_choice_1] and self-relation[field_choice_1].
That is a very interesting suggestion, because probably nobody knew, that you could “talk” with a controller from a calculation. But yes, you can. It does work this way as well!
But it also throws an error “cannot convert…” as my way above. Does this need a fix from Servoys side or can I do something to avoid the error? The results are great, anyway
first of all
using currentcontroller is very dangerous.
Because what happens if that calculation is on another form (completely not displayed or displayed in a tab??)
Then the currentcontroller doesn’t point to the table of the calculation.
about that error. I don’t know exactly when that error is exactly generated. Because you do say that it works?? You do see the right value?
Then this is very strange.
i need to have/make an example to see that.
can’t you try a eval function for this? (but i don’t know if eval will return something.. have to check:
I thought that you didn’t enjoy me discover that you could use currentcontroller . I thought there was a good reason you left controller methods out of the calculation area and I do see the point.
But then: eval also works. But also throws an error. I will make an example solution so you can see what happens.
Just figured out that the error thrown just occurs in conjunction with the method I use to choose the field. I just changed something there and now it works like a charm.
Thanks for your input. Basically all of the suggestions (including my own) seem to work smoothly.