How to Enter Value from Another Table in a Generated Column expression?

Hi,
I have two tables A and B
in table B i have only one object and Two columns X and Y,

I update its values daily by a timer from an external host

now i want to create a generated column and make an expression to
get the value from column β€œX” from table B and divide it by each value from table A no matter how many object created in table A.
the question is how to write an expression like this?
i tried to write B.X / value but its not working
@mark-piller
@vladimir-upirov

@vladimir-upirov

@mark-piller

@mark-piller

@vladimir-upirov

Hello, @Mohammed_Abdalla.

We are considering your question, give us a little time.

Regards, Nikita.

1 Like

Hello @Mohammed_Abdalla

You are not able to create generated column with relations. In the generated column you can use only columns from the table you are creating a column in.

In my opinion it is not possible to do by one call. So my suggestion is the following:

  1. Get all data from A and create a factor var f = 1 / A1 / A2 / ... / An
  2. Then get data with selected property valueB*<f> as valueWithFactor for example f is 0.5 then use the fallowing select
property=valueB*0.5%20as%20valueWithFactor
1 Like

@Nikita_Fedorishchev
ok, thanks

Hello,

Just double checking on this since it’s been a couple years. Is it still not possible to write an expression in a column from table A based off of data from table B?

I also have a similar instance where this would be great but if it’s still not possible to do in one SQL expression then I have a workaround option in mind that uses API calls from the UI.

Thanks
Austin

Hi Austin,

It is not possible to create a generated column in a table based on a value from another table. The closest solution would be creating a database View. That approach allows you to combine multiple columns from related tables in one virtual (read-only) table.

Regards,
Mark

Thank you Mark, that is helpful.

Thanks Mark. I’d just like to +1 this as something that would be valuable.