OctoberCMS columns.yaml VALUE FROM with multiple fields

Ad

I have created one plugin using Builder plugin in OctoberCMS and in which I have columns.yaml file.

In a field called property_id, I have a field as VALUE FROM which is asking to add my table's field name hence I have added one called as street_number.

But I want to concat multiple fields there. Something like below.

CONCAT(street_number, ' ', address)

But this is not working. I have also tried with other ways but its still not working.

Can someone guide me how to accomplish this ?

Additionally, It will be great if these fields gets concat if their respective values exists in table.

This is how my columns.yaml file looks like.

columns:
    property_id:
        label: Property
        type: text
        searchable: true
        sortable: false
        relation: Property
        valueFrom: street_number
    start_datetime:
        label: 'Start Date Time'
        type: datetime
        searchable: true
        sortable: true
    end_datetime:
        label: 'End Date Time'
        type: datetime
        searchable: true
        sortable: true
    status:
        label: Status
        type: number
        searchable: true
        sortable: true
        select: 'CASE WHEN (status =  ''1'' ) THEN ''Active'' ELSE ''Inactive'' END'

Thanks

Ad

Answer

Ad

Since there is logic involved here you might just wanna use a custom column type as detailed here https://octobercms.com/docs/backend/lists#custom-column-types. I wouldn't wanna put too much logic inside the yaml file.

EDIT

The OP has added some example code to show exactly what I mentioned above in his comment here.

Ad
source: stackoverflow.com
Ad