DB Function in Schema -> Table -> Field?


#1

Hi,

Just recently noticed that in Schema -> Table -> Field setup, there is now a Field for DB Function and DB Function Return Type.

What are these for? Is there any documentation on the uses?

Is it possible to use a custom database function? If so, I was maybe planning on using this to determine whether or not the current user has access to the said record which is in relation to this thread I created a while back.

Regards,
Allen


#2

@allensandiego The feature was added in 2.0.2. Here is the wiki doc on it. Also see Virtual Fields section just above it for more info. Still filling out the docs, so let me know if you have more questions.


#3

Hi @leehicks,

Thanks for the info.

Would like to ask, will I be able to use this field in the Role Access Field?

For ex: I have added a field named “authorized” which is a boolean. Then the DB Function is a user-defined function that either returns true or false depends on the logic inside. So you could say in the DB Function, “auth(record_id, owner_id)”.

Will this work?

Regards,
Allen


#4

@allensandiego Well, I hadn’t actually thought about using them in Role Service Access Filter situations, but that is a good call. I tested out the idea and it doesn’t work, unfortunately tries to use the field name directly. I will put this as a feature request and try to get it in the next sprint.


#5

Hi @leehicks,

This feature will be a greate addition. If you can also add the feature I mentioned in this thread.

Thanks,
Allen


#6

How do you go about defining the virtual field?
Thanks
Rajiv