Error while filtering the data

Hi all .

I'm getting this error 

Interface Definition: Expression evaluation error in rule 'kpl_parentprocessmodel' at function a!gridField_19r1 [line 31]: A grid component [label=“”] has an invalid value for “value” and “totalCount”. “startIndex” must not be greater than “totalCount”, but “startIndex” was 476 and “totalCount” was 0.

i have two filter assigned and completed , the error is showing when i got max value for completed and again choosing the filter assigned . becz assigned result is 300 and completed is 698

Thanks 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    If you're going to use the old paging grid (i.e. a!gridField_19r1), then you must set up your on-form filters to reset the startIndex whenever they're changed, because if the grid has been paged forward to a further page (let's say page 3), but then the filter selected narrows the returned data set down to have only 1 or 2 pages, the startIndex will be invalid and you'll get that error.

    FYI, the new (19.2+) paging grid, when used correctly, automatically handles paging issues like this.  As far as I've seen so far, to make use of this feature requires doing the query directly in the data: parameter, since this uses the component's built-in paging info instead of one you define yourself in your interface like typically done in the older version.

  • Can you please suggest me how it can be reset 

    a!dropdownField(
    label: "Status",
    labelPosition: "ABOVE",
    placeholderLabel: "--- Select a Value ---",

    choiceLabels: {cons!NPL_REQUEST_STATUS[1],cons!NPL_REQUEST_STATUS[2] },

    choiceValues: {0,2},
    value:local!Status,
    saveInto: {local!Status},


    /*saveInto:{local!Status,*/
    /*local!pagingInfo.startIndex<<rule!APN_returnFirstInput(1,_)*/
    /*},*/



    validations: {}
    )

  • 0
    Certified Lead Developer
    in reply to danb0002

    Hi danb0002, 

    As Mike suggested, you should reset your start index to 1, whenever you are applying filters.

    Here is the code I have updated, hope this helps

    a!dropdownField(
      label: "Status",
      labelPosition: "ABOVE",
      placeholderLabel: "--- Select a Value ---",
      choiceLabels: {
        cons!NPL_REQUEST_STATUS[1],
        cons!NPL_REQUEST_STATUS[2]
      },
      choiceValues: {
        0,
        2
      },
      value: local!Status,
      /*saveInto: {*/
      /*local!Status*/
      /*},*/
      saveInto: {
        local!Status,
        a!save(
          local!pagingInfo.startIndex,
          1
        )
      },
      validations: {}
    )

  • Can , anyone help me out ... I'm struggling with this  

  • 0
    Certified Lead Developer
    in reply to danb0002

    Vimal's sample code above was correct.  But it's impossible for anyone here to provide more precise help unless you post a current code sample that includes both the definition of your PagingInfo local variable, as well as your filter's current saveInto configuration.

  • load(
    local!pagingInfo: a!pagingInfo(startIndex: 1, batchSize:25),

    with(
    local!dataset: a!queryProcessAnalytics(
    report: cons!NPL_TASK_REPORT,
    contextProcessModels: cons!NPL_PROCESS_MODEL,
    query: a!query(
    logicalExpression: a!queryLogicalExpression(
    operator: "OR",
    filters: {
    a!queryFilter(
    field: "c1",
    operator: "=",
    value: if(rule!NPL_checkIsNullOrEmpty(ri!status)," ",ri!status),
    ),

    },
    ),

    pagingInfo: local!pagingInfo
    )
    ),

    {
    a!boxLayout(
    label:"Tasks",
    style: "ACCENT",
    contents: a!sectionLayout(
    contents: {
    a!gridField_19r1(
    data:local!dataset.data,
    totalCount: local!dataset.totalcount,
    value: local!pagingInfo,
    saveInto:local!pagingInfo,

    columns: {
    a!gridTextColumn(
    label:"Task Name",
    field:"c0",
    data:index(local!dataset.data,"c0",{}),
    links:a!forEach(
    items:index(local!dataset,"identifiers",{}),
    expression:a!processTaskLink(
    task:fv!item
    )
    )
    ),

    a!gridTextColumn(
    label:"User Name",
    field:"c1",

    data:apply(rule!APN_displayUser,(index(local!dataset.data,"c12",{})))

    ),

    a!gridTextColumn(
    label:"RequestId",
    field:"c2",
    data:index(local!dataset.data,"c5",{})
    ),
    a!gridTextColumn(
    label:"Start Date",
    field:"c3",
    data:index(local!dataset.data,"c3",{})
    ),
    a!gridTextColumn(
    label:"End Date",
    field:"c4",
    data:(index(local!dataset.data,"c11",{}))

    ),


    a!gridTextColumn(
    label: "Duration in Days",
    data: a!forEach(
    items: local!dataset.data,
    expression: tointeger(todate(fv!item.c11) - todate(fv!item.c3))

    )
    ),


    a!gridTextColumn(
    label:"Status",
    field:"c5",

    data:a!forEach(
    items:index(local!dataset.data,"c1",{}) ,
    expression:
    displayvalue( fv!item, {0, 2},
    {"Assigned","Completed"}, " " )
    )

    ),

    a!gridTextColumn(
    label:"GropInfo",
    field:"c6",
    data:index(local!dataset.data,"c9",{})
    ),

    }
    )
    }
    )
    )

    }
    )
    )

    this is my expression rule 

    and i'm calling this into blew interface using filter 


    load(
    local!Status,

    local!pagingInfo:a!pagingInfo(startIndex: 1, batchSize: 25),

    {
    a!columnsLayout(
    columns: {
    a!columnLayout(
    contents: {
    a!dropdownField(
    label: "Status",
    labelPosition: "ABOVE",
    placeholderLabel: "--- Select a Value ---",

    choiceLabels: {cons!NPL_REQUEST_STATUS[1],cons!NPL_REQUEST_STATUS[2] },

    choiceValues: {0,2},
    value:local!Status,
    saveInto: {local!Status},

    /*saveInto:{local!Status,*/
    /*local!pagingInfo.startIndex<<rule!APN_returnFirstInput(1,_)*/
    /*},*/
    /*saveInto: {*/
    /*local!Status,*/
    /*a!save(*/
    /*local!pagingInfo.startIndex,*/
    /*1*/
    /*)*/
    /*},*/

    validations: {}
    )

    },
    width: "MEDIUM"

    )

    }
    ),

    rule!NPL_ParentProcessModel(status:local!Status)
    }


    )

  • 0
    Appian Employee
    in reply to danb0002

    The problem is that you have local!pagingInfo set in both places - your child rule and the parent one. The pagingInfo you need to update is the child one, but the only one you're updating is the parent one. Honestly, I'd suggest putting everything into a single interface, which will be easier to debug and ensure you're using the right variable.

    If you still want to keep them separate, add a rule input to your child rule called pagingInfo (type pagingInfo) and replace all the instances of local!pagingInfo with ri!pagingInfo in the child rule.

  • +1
    Certified Lead Developer
    in reply to danb0002

    In addition to the below suggested code, I would recommend you to start using the latest Paging Grid component if possible [https://docs.appian.com/suite/help/19.2/Paging_Grid_Component.html]

    /* Your parent rule should like the below */
    load(
      local!Status,
      local!pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: 25
      ),
      {
        a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                a!dropdownField(
                  label: "Status",
                  labelPosition: "ABOVE",
                  placeholderLabel: "--- Select a Value ---",
                  choiceLabels: {
                    cons!NPL_REQUEST_STATUS[1],
                    cons!NPL_REQUEST_STATUS[2]
                  },
                  choiceValues: {
                    0,
                    2
                  },
                  value: local!Status,
                  saveInto: {
                    local!Status,
                    a!save(
                      local!pagingInfo.startIndex,
                      1
                    )
                  },
                  validations: {}
                )
              },
              width: "MEDIUM"
            )
          }
        ),
        rule!NPL_ParentProcessModel(
          status: local!Status,
          pagingInfo: local!pagingInfo
        )
      }
    )
    
    /* --------------------------------------------------------  */
    /* create a rule input "pagingInfo [type-PagingInfo]" in interface NPL_ParentProcessModel and update your code as below*/
    with(
        local!dataset: a!queryProcessAnalytics(
          report: cons!NPL_TASK_REPORT,
          contextProcessModels: cons!NPL_PROCESS_MODEL,
          query: a!query(
            logicalExpression: a!queryLogicalExpression(
              operator: "OR",
              filters: {
                a!queryFilter(
                  field: "c1",
                  operator: "=",
                  value: if(
                    rule!NPL_checkIsNullOrEmpty(
                      ri!status
                    ),
                    " ",
                    ri!status
                  ),
                  
                ),
                
              },
              
            ),
            pagingInfo: ri!pagingInfo
          )
        ),
        {
          a!boxLayout(
            label: "Tasks",
            style: "ACCENT",
            contents: a!sectionLayout(
              contents: {
                a!gridField_19r1(
                  data: local!dataset.data,
                  totalCount: local!dataset.totalcount,
                  value: ri!pagingInfo,
                  saveInto: ri!pagingInfo,
                  columns: {
                    a!gridTextColumn(
                      label: "Task Name",
                      field: "c0",
                      data: index(
                        local!dataset.data,
                        "c0",
                        {}
                      ),
                      links: a!forEach(
                        items: index(
                          local!dataset,
                          "identifiers",
                          {}
                        ),
                        expression: a!processTaskLink(
                          task: fv!item
                        )
                      )
                    ),
                    a!gridTextColumn(
                      label: "User Name",
                      field: "c1",
                      data: apply(
                        rule!APN_displayUser,
                        (
                          index(
                            local!dataset.data,
                            "c12",
                            {}
                          )
                        )
                      )
                    ),
                    a!gridTextColumn(
                      label: "RequestId",
                      field: "c2",
                      data: index(
                        local!dataset.data,
                        "c5",
                        {}
                      )
                    ),
                    a!gridTextColumn(
                      label: "Start Date",
                      field: "c3",
                      data: index(
                        local!dataset.data,
                        "c3",
                        {}
                      )
                    ),
                    a!gridTextColumn(
                      label: "End Date",
                      field: "c4",
                      data: (
                        index(
                          local!dataset.data,
                          "c11",
                          {}
                        )
                      )
                    ),
                    a!gridTextColumn(
                      label: "Duration in Days",
                      data: a!forEach(
                        items: local!dataset.data,
                        expression: tointeger(
                          todate(
                            fv!item.c11
                          ) - todate(
                            fv!item.c3
                          )
                        )
                      )
                    ),
                    a!gridTextColumn(
                      label: "Status",
                      field: "c5",
                      data: a!forEach(
                        items: index(
                          local!dataset.data,
                          "c1",
                          {}
                        ),
                        expression: displayvalue(
                          fv!item,
                          {
                            0,
                            2
                          },
                          {
                            "Assigned",
                            "Completed"
                          },
                          " "
                        )
                      )
                    ),
                    a!gridTextColumn(
                      label: "GropInfo",
                      field: "c6",
                      data: index(
                        local!dataset.data,
                        "c9",
                        {}
                      )
                    ),
                    
                  }
                )
              }
            )
          )
        }
      )

  • Hi Dude , 

    if I'm tring the above code the page wont go for another page , i mean its not going for 26 to 76

  • Any one can please help me out , I'm new to appian 

Reply Children
No Data