UiPath Apps | Show "n" number of values in the drop down

Hi Team,

I am using a dropdown in UiPath Apps and need to show only n number of values.
Example: Show only latest 6 values.

Could you please support me on this?

Thanks

@Kavindu_Dilshan

you can use something liek this

Listsrc.Data.Take(6).ToListSource

this will get only 6 items from list…if you want to make it variable then can add input for it and use that variable here
cheers

Hi @Anil_G ,

Thank u and could u please share an example or screenshot of this how to use please?

@Kavindu_Dilshan

If you want to use for a specific number always then just copy paste the above formula in listsourcefield of dropdown…ensure you use your listsource variable my variable is listsrc…you need to change

If you need to fetch how many to display from user then

Create a app variable of listsource type…

And link that variable to dropdown listsource

Now create a event rule on input firld where you would ask the user to input the value…now use a set value in create field and set the list source variable usign listsec.Data.Take(valuefromlabel).ToListSource

Hope this is clear

Cheers

@Kavindu_Dilshan,

Try this expression in your List Source of Drop down.

Thanks,
Ashok :slight_smile:

Hi @Anil_G & @Anil_G ,

Thanks a lot and I need add the sort according to the descending order as well to the same query. How do I achieve that?

Thanks

@Kavindu_Dilshan

try like this

Listsrc.data.OrderByDescending(Function(x) x.DisplayName).Take(6).ToListSource

cheers

1 Like

@Kavindu_Dilshan,

If you want to take first 6 rows and then sort those in descending order then try this query.

dtDropdownSource.ToListSource().data.Take(6).OrderByDescending(Function(row) row.Item(0)).ToListSource()

Thanks,
Ashok :slight_smile:

Hi @ashokkarale ,

I am getting below error :frowning:

image

@Kavindu_Dilshan,

Remove Item and check what are the available columns there. Select the suitable one.

Thanks,
Ashok :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.