Allowing limited number values displaying in Drop down?

Certified Senior Developer

Hello,

 

 

 How Can I display the limited number of values in the Dropdown Component?

 

 

Thanks in Advance

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Hi @ 

    There are various options to display limited number of choice options to display in a drop-down component, for example:

     

    Let's assume you are pulling few rows from your reference table to display it under the drop-down component. And assume you have more than 10 rows available in DB but you just want to limit the set of options to 10 then, you can make the use of pagingInfo while querying the data, as mention below:

    rule!yourQueryEntity(
        pagingInfo: a!pagingInfo(
            startIndex: 1, 
            batchSize: 10, 
            sort: a!sortInfo(
                field: "your Field Name/Primary Key Column",
                ascending: true()
            )
         )
    )

    In this case irrespective of how many rows you have in your DB, Query Entity will only pull 10 rows sorted by the provided column and will display the same under dropdown component.

     

    But, out of interest, why do you want to show only few options under a drop-down, is that based on some conditions?

  • 0
    Certified Senior Developer
    in reply to aloks0189

    Hi,

    Thanks for the reply everyone,
    My exact question is In the database table there are 50 rows of data. Initially, in the dropdown, I need to display 10 rows and below the dropdown, I need to give one link i.e "showall", If user Clicks that showall link I need to display all the rows(50) in the drop-down.


    Thanks.

  • +1
    Certified Lead Developer
    in reply to sandeepn

    Hi @sandeepn ,

    To achieve this you can follow below mentioned steps.

    1. Define a variable on load() of this interface

    local!paging_pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: 10,
        sort: a!sortInfo(
          field: "Your Primary Key/ or any other column",
          ascending: true()
        )
      )

    2. Now call the Query Entity Rule by passing this local variable as an input for PagingInfo. this means initially Query Entity will pull 10 rows only. And store the query result into a local Variable, say local!datasubset.

    3. Define and configure the dropdown.

    4. Define a Link Field with a Dynamic Link (say, Show All) below/beside your dropdown depending on your requirement and configure it as follows.

    a!linkField(
            links: a!dynamicLink(
            label: "Show More",
              saveInto: {
                a!save(
                  local!paging_pagingInfo, /* Variable declared on load */
                  a!pagingInfo(
                    startIndex: 1,
                    batchSize: - 1,
                    /*Querying all the rows*/
                    sort: a!sortInfo(
                      field: "Your Primary Key/ or any other column",
                      ascending: true()
                    )
                  )
                ),
                /*Assuming yourQueryEntity is the name of your rule to Query the data.*/
                a!save(
                  local!datasubset,
                  rule!yourQueryEntity(pagingInfo: local!paging_pagingInfo)
                )
              }
            )
          )

    Hope this will help.

Reply Children
No Data