Skip to main content
yandiw6015
New Participant
December 12, 2023
Solved

how can i add two filter above the readonly gird

  • December 12, 2023
  • 2 replies
  • 6 views

i want to add two filter about departemnt and status above list

how can i add it?

and my expression is written below

a!headerContentLayout(
  header: {},
  contents: {
    a!gridField(
      label: "タスクä¸`覧",
      labelPosition: "ABOVE",
      data: a!queryProcessAnalytics(
        report: cons!DM01_process_report_pointer,
        contextProcessModels:cons!DM01_process_model_pointer,
        query:a!query(
          pagingInfo: fv!pagingInfo
        )
      ),
      columns: {
        a!gridColumn(
          label:"タスク内容",
          value:a!linkField(
            links: a!processTaskLink(
              label:fv!row.c0,
              task:fv!identifier
            )
          )
          
        ),


        a!gridColumn(
          label: "departement",
          sortField: "c4",
          value: fv!row.c4,
          align: "START"
        ),
        a!gridColumn(
          label:"status",
          value:rule!DM01_GetTaskName(status: fv!row.c1)
        ),
      
        
        a!gridColumn(
          label: "申請時間",
          value: text(fv!row.c3,"yyyyå¹´ mmmddæ—¥ hh:mm AM/PM")
        )
        
      },
      validations: {}
    )
  }
)

/resized-image/__size/640x480/__key/communityserver-discussions-components-files/13/_B930AF30EA30FC30F330B730E730C330C830_-2023_2D00_12_2D00_12-170544.jpg

    Best answer by rajeshp9724

    Hi [mention:fc46a526fd624679a14c58a0bd0c83d8:e9ed411860ed4f2ba0265705b8793d05] ,

    you can use the below code for the requirement

    a!localVariables(
    local!deptFilter,
    local!statusFilter,
    local!pagingInfo:a!pagingInfo(1,1000),
    local!data:a!queryProcessAnalytics(
    report: cons!DM01_process_report_pointer,
    contextProcessModels:cons!DM01_process_model_pointer,
    query:a!query(
    pagingInfo: local!pagingInfo,
    logicalExpression: a!queryLogicalExpression(
    operator:"AND",
    filters:{
    a!queryFilter(
    field:"department",
    operator:"=",
    value:local!deptFilter
    ),
    a!queryFilter(
    field:"status",
    operator:"=",
    value:local!statusFilter
    )
    }
    )

    )
    ),
    a!headerContentLayout(
    header: {},
    contents: {
    a!columnsLayout(
    columns:{
    a!columnLayout(
    contents:{
    a!textField(
    label:"Department",
    value:local!deptFilter,
    saveInto:local!deptFilter
    )
    }
    ),
    a!columnLayout(
    contents:{
    a!textField(
    label:"status",
    value:local!statusFilter,
    saveInto:local!statusFilter
    )
    }
    )
    }
    ),
    a!gridField(
    label: "タスク一覧",
    labelPosition: "ABOVE",
    data: local!data,
    columns: {
    a!gridColumn(
    label:"タスク内容",
    value:a!linkField(
    links: a!processTaskLink(
    label:fv!row.c0,
    task:fv!identifier
    )
    )

    ),


    a!gridColumn(
    label: "departement",
    sortField: "c4",
    value: fv!row.c4,
    align: "START"
    ),
    a!gridColumn(
    label:"status",
    value:rule!DM01_GetTaskName(status: fv!row.c1)
    ),


    a!gridColumn(
    label: "申請時間",
    value: text(fv!row.c3,"yyyy年 mmmdd日 hh:mm AM/PM")
    )

    },
    validations: {}
    )
    }
    )
    )

    Note: Based on the requirement you can use dropdown fields instead of text field in the above code

    2 replies

    vinaykumarp8308
    Participating Frequently
    December 13, 2023

    Hello [mention:fc46a526fd624679a14c58a0bd0c83d8:e9ed411860ed4f2ba0265705b8793d05] ,

    You can add two fields (based on the requirements - text or drop down) above the gridField() and the saved filter value can be passed in the query function to fetch the filtered data.

    Vinay Putchala
    Inspiring
    December 15, 2023

    Hi [mention:fc46a526fd624679a14c58a0bd0c83d8:e9ed411860ed4f2ba0265705b8793d05] ,

    you can use the below code for the requirement

    a!localVariables(
    local!deptFilter,
    local!statusFilter,
    local!pagingInfo:a!pagingInfo(1,1000),
    local!data:a!queryProcessAnalytics(
    report: cons!DM01_process_report_pointer,
    contextProcessModels:cons!DM01_process_model_pointer,
    query:a!query(
    pagingInfo: local!pagingInfo,
    logicalExpression: a!queryLogicalExpression(
    operator:"AND",
    filters:{
    a!queryFilter(
    field:"department",
    operator:"=",
    value:local!deptFilter
    ),
    a!queryFilter(
    field:"status",
    operator:"=",
    value:local!statusFilter
    )
    }
    )

    )
    ),
    a!headerContentLayout(
    header: {},
    contents: {
    a!columnsLayout(
    columns:{
    a!columnLayout(
    contents:{
    a!textField(
    label:"Department",
    value:local!deptFilter,
    saveInto:local!deptFilter
    )
    }
    ),
    a!columnLayout(
    contents:{
    a!textField(
    label:"status",
    value:local!statusFilter,
    saveInto:local!statusFilter
    )
    }
    )
    }
    ),
    a!gridField(
    label: "タスク一覧",
    labelPosition: "ABOVE",
    data: local!data,
    columns: {
    a!gridColumn(
    label:"タスク内容",
    value:a!linkField(
    links: a!processTaskLink(
    label:fv!row.c0,
    task:fv!identifier
    )
    )

    ),


    a!gridColumn(
    label: "departement",
    sortField: "c4",
    value: fv!row.c4,
    align: "START"
    ),
    a!gridColumn(
    label:"status",
    value:rule!DM01_GetTaskName(status: fv!row.c1)
    ),


    a!gridColumn(
    label: "申請時間",
    value: text(fv!row.c3,"yyyy年 mmmdd日 hh:mm AM/PM")
    )

    },
    validations: {}
    )
    }
    )
    )

    Note: Based on the requirement you can use dropdown fields instead of text field in the above code