Virtual Column of value from reference list

R41Z0R
New Member

Hi there,

I have a problem getting a function done. I have two tables, one table has my customers with a customer-id that is unique, the other tables holds contracts of customers with a reference value customer-id. The reference is working and so on.

The table contracts has a column called โ€œcontracttypeโ€ of type enum with the values: Main, second, third.

Now I want to have a virtual column in my main table customer called โ€œmain contractโ€ that gives me the name (other column in contract) of that contract.

My formula looks like this, but returns multiple values, I donโ€™t know how i make that double selection.

SELECT(contract[contracttype], [customer_id] = [_THISROW].[customer_id]) <-- Now how i filter it by the term โ€œMainโ€.

I tried this:
SELECT(contract[contracttype], AND([customer_id] = [_THISROW].[customer_id]), contract[contracttype] = โ€œMainโ€) <-- But tells me Cannot compare List with Text.

Iโ€™m happy for any help, thanks.

Solved Solved
0 2 338
1 ACCEPTED SOLUTION

Bahbus
New Member

contract[contracttype] is the List of all [contracttype]s within the table contract.

SELECT(
    contract[contracttype], 
    AND(
        [customer_id] = [_THISROW].[customer_id], 
        โ€œMainโ€ = [contracttype]
    )
)

View solution in original post

2 REPLIES 2

Bahbus
New Member

contract[contracttype] is the List of all [contracttype]s within the table contract.

SELECT(
    contract[contracttype], 
    AND(
        [customer_id] = [_THISROW].[customer_id], 
        โ€œMainโ€ = [contracttype]
    )
)

R41Z0R
New Member

Amazing, thanks for the tipp, works like a charm

Top Labels in this Space