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 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分