I want to set batch size as -1

a!localVariables(
  local!pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 100
  ),
  local!channelManagerData: rule!BGH_QE_GetChannelManagerID(),
  local!dataSubset: rule!BGH_getSupplierTaskPropertyReports(
    pagingInfo: local!pagingInfo
  ),
  local!selectedTask,
  local!data,
  local!selectionIndex,
  local!supplierID,
  local!selectedSupplierID,
  local!selectedSupplierData,
  local!channelManagerChoiceLabels: index(
    local!channelManagerData,
    "name_text",
    {}
  ),
  local!channelManagerChoiceValues: index(
    local!channelManagerData,
    "channelManagerID_int",
    {}
  ),
  {
    a!sectionLayout(
      contents: {
        a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                a!dropdownField(
                  label: "Select Channel Manager",
                  choiceLabels: append(
                    local!channelManagerChoiceLabels,
                    "Others"
                  ),
                  choiceValues: append(
                    local!channelManagerChoiceValues,
                    0
                  ),
                  placeholderLabel: "--Select value--",
                  value: local!selectedTask,
                  saveInto: {
                    local!selectedTask,
                    a!save(
                      local!data,
                      index(
                        local!datasubset.data,
                        wherecontains(
                          tostring(
                            local!selectedTask
                          ),
                          touniformstring(
                            index(
                              local!datasubset.data,
                              "c12",
                              ""
                            )
                          )
                        ),
                        {}
                      )
                    ),
                    a!save(
                      local!supplierID,
                      union(
                        index(
                          local!data,
                          "c11",
                          ""
                        ),
                        index(
                          local!data,
                          "c11",
                          ""
                        )
                      )
                    ),
                    a!save(
                      local!selectedSupplierID,
                      null
                    ),
                    a!save(
                      local!selectedSupplierData,
                      null
                    ),
                    a!save(
                      local!selectionIndex,
                      null
                    )
                  }
                )
              }
            ),
            a!columnLayout(
              contents: {
                if(
                  rule!APN_isBlank(
                    local!supplierID
                  ),
                  a!textField(
                    value: "No Task is available on corresponding channel Manager",
                    readOnly: true,
                    showWhen: not(
                      rule!APN_isBlank(
                        local!supplierID
                      )
                    )
                  ),
                  a!dropdownField(
                    label: "Select Supplier",
                    choiceLabels: if(
                      tointeger(
                        local!supplierID
                      ) = 0,
                      "Other Supplier",
                      a!forEach(
                        items: local!supplierID,
                        expression: rule!BGH_QE_getSupplier_ID(
                          fv!item
                        )
                      )
                    ),
                    choiceValues: a!forEach(
                      items: local!supplierID,
                      expression: fv!item
                    ),
                    placeholderLabel: "Select Required Supplier",
                    value: local!selectedSupplierID,
                    saveInto: {
                      local!selectedSupplierID,
                      a!save(
                        local!selectedSupplierData,
                        rule!BGH_getSupplierTaskPropertyReports(
                          pagingInfo: local!pagingInfo,
                          managerID: local!selectedTask,
                          supplierID: local!selectedSupplierID
                        )
                      ),
                      a!save(
                        local!selectionIndex,
                        null
                      )
                    },
                    showWhen: not(
                      rule!APN_isBlank(
                        local!supplierID
                      )
                    )
                  )
                )
              }
            )
          },
          marginBelow: "STANDARD"
        ),
        if(
          rule!APN_isBlank(
            local!selectedSupplierData
          ),
          {},
          a!gridField(
            label: "Select Tasks",
            data: local!selectedSupplierData,
            columns: {
              a!gridColumn(
                label: "Task Name",
                value: index(
                  fv!row,
                  "c0",
                  ""
                )
              ),
              a!gridColumn(
                label: "Process Name",
                value: index(
                  fv!row,
                  "c2",
                  ""
                )
              ),
              a!gridColumn(
                label: "Status",
                value: if(
                  index(
                    fv!row,
                    "c0",
                    ""
                  ) = "0",
                  "Open",
                  "Assigned"
                )
              ),
              a!gridColumn(
                label: "Start Time",
                value: if(
                  rule!APN_isBlank(
                    fv!row.c3
                  ),
                  "",
                  text(
                    index(
                      fv!row,
                      "c3",
                      ""
                    ),
                    "DD/MM/YYYY HH:MM A"
                  )
                )
              ),
              
            },
            pagingSaveInto: local!pagingInfo,
            selectable: true(),
            selectionValue: local!selectionIndex,
            selectionSaveInto: local!selectionIndex
          )
        )
      },
      divider: "BELOW"
    ),
    if(
      or(
        isnull(
          local!selectionIndex
        ),
        length(
          local!selectionIndex
        ) > 0
      ),
      a!richTextDisplayField(
        label: "No Open tasks to close",
        showWhen: if(
          or(
            isnull(
              local!supplierID
            ),
            length(
              local!supplierID
            ) = 0
          ),
          if(
            not(
              isnull(
                local!selectedTask
              )
            ),
            true,
            false
          ),
          false
        )
      ),
      {}
    ),
    a!buttonLayout(
      primaryButtons: a!buttonWidget(
        label: "Close Task",
        submit: true(),
        confirmMessage: "Are you sure you want to close Task?",
        skipValidation: true,
        style: "PRIMARY",
        value: true(),
        saveInto: {
          a!save(
            ri!processId,
            local!selectionIndex,
            
          )
        },
        disabled: rule!APN_isEmpty(
          local!selectionIndex
        ) > 0
      ),
      secondaryButtons: {
        a!buttonWidgetSubmit(
          label: "Cancel",
          style: "NORMAL",
          confirmMessage: "Are you sure?",
          saveInto: ri!buttonValue,
          value: true(),
          skipValidation: true
        )
      }
    )
  }
)

After inserting -1 I am getting with an error like below

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!gridField [line 164]: A grid component [label=“Select Tasks”] has an invalid value for “data”. “data” may not be a datasubset containing the entire data set. Update the “data” parameter to receive only the array of data (such as by indexing into the “data” parameter on the datasubset), or set a batch size to only pass a subset of the data.

After this error i had changed line 166 like below

data: local!selectedSupplierData.data, after placing this error will be resolved, but the challenged I faced that I am unable to close the task after placing batchsize as -1 and line number 166 as local!selectedSupplierData.data.For closing tasks, I am using a complete task smart service.

Thanks in advance

  Discussion posts and replies are publicly visible

  • It isn't possible to use a batch size of -1 with the the new version of the grid field because it can lead to performance problems if you accidentally return more data than you expected. How many rows do you expect to display in your grid? Could you use a batch size like 50 or 100 that would display a large number of rows without showing all of them?

  • Thanks for ur response Peter

    But I had used batch size as 100 but in real-time there are large number rows to close at a time we are facing challenges though it as 100. Could you please suggest any other solution?

  • Can you explain how you are using the grid? I'm not sure I understand what this line means: 

    but the challenged I faced that I am unable to close the task after placing batchsize as -1 and line number 166 as local!selectedSupplierData.data.

    Keep in mind that a grid with more than 100 rows isn't a good design (even if your data source has more rows). Users simply won't scroll through that many rows - it's the same reason that google only displays 10 items per page because they assume you won't even look past the first 10 items. It's much more effective to add additional filters to allow users to find what they need rather than showing all the data in a grid.

  • 0
    Certified Lead Developer
    in reply to satishk0001
    Could you please suggest any other solution?

    I agree with Peter here - if your real-world usage will have more than 100, then you should look into other options like paging (with a reasonable paging size limit closer to 10 or 20 for example) and filtering, as opposed to trying to show every single row on one page.

  • Thanks, Peter & Mike

    So the scenario is like below... 

    If I had 1000 open tasks in the Tasks report but in UI it will show only 100 because I set batch size as 100 and page size is 10.

    So my question is that if I want to close the remaining 900 open tasks I have to close the first 100 and then I have to close the remaining 900? Then it will take a long time to close the open tasks?

  • 0
    Certified Lead Developer
    in reply to satishk0001

    I assume you're doing something like having the user select lines from the grid (many at a time) and press a button that "closes" that task ID, or something similar?

    If so, there are many different ways you could accomplish this if a user really wants to clear out every single task and there are several hundred or a thousand - without needing to display a grid with all 1,000 tasks showing all at once.  You could, for example, have a link or button below the grid where when clicked, it selects all tasks currently in the data set, whether or not showing on the current grid page.  Or you could just have a control for "close all" which, after the user preferably is forced to confirm one or two times that they're sure, just automatically closes all tasks in the data set.  Or various other possibilities.

  • 0
    Certified Lead Developer
    in reply to satishk0001

    Not at all.  You could simply click on the next page.  That shows tasks 101-200.  Click twice more and you've got 401-500.  You can find all the tasks you need.  What you're doing is only pulling the tasks after the 100th task WHEN YOU NEED TO.  That's all batch size does.  It's not all you get; it's all you get EACH PAGE.  Think of it more like "page size" in this instance.

    You can use filters and other things suggested to limit the number that a user has to scan through and help them find a particular task more quickly, but there's nothing preventing you from allowing the user to scan through all of them if he or she wants to, just in more digestible chunks presented on pages.

    Now, do you want to show 1000 in 10 pages of 100 each, 20 pages of 50 each, 50 pages of 20 each, 40 pages of 25 each?  It's all up to you.