dongyi1490 2017-05-04 06:01
浏览 119
已采纳

OctoberCMS columns.yaml VALUE FROM包含多个字段

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

  • 写回答

2条回答 默认 最新

  • duanbiyi7319 2017-05-06 22:05
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 shape_predictor_68_face_landmarks.dat
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料