Pick Year, and list of number between two values

I want my users to be able to pick a year. Using the “pick date” flow function you must pick a day month and year, but I only want them to be able to pick the year.

Also is there a way I can make a list of numbers between two values using a formula so that I can put it in the “pick value” flow function? For example Numbers between 100 and 100,000 using intervals 100.
Any help would be appreciated.

The “Quantity Selector” in the marketplace might suit your needs. Just set the minimum value (2021) and the max value to whatever you want (2099?). They can press + or - to adjust or can type the year in directly.

This isn’t allowing me to use a minimum value, no matter what I set it to it starts off as 0. It also isn’t allowing the quantity to be typed. Do you have another suggestion?

Oh yeah, now I remember why I built my own because the stock one didn’t work very well. Here’s how I built one that functioned correctly and looked better:

1. Create page variable to hold user’s year value they input. Set default value to whatever you want the control to start at (or you can set this later with some logic flow if you like).

2. Create your component as follows:
Container (rounded corners)
Inside that container, add a row with 3 cells
– Cell 1 (add a - icon)
– Cell 2 (add input primitive – not input field) - set keyboard to number-pad and bind value to page variable you made in step 1
– Cell 3 (add a + icon)

3. For the 1st and 3rd cells (the - and +) add flows such as following to the component tap:

The first block (Unfocus Input from market) - bind this to the input component that’s in cell #2
The 2nd block actually performs the - or +. For this, use a “Set page variable”, set it to use your variable that you tied your input to (e.g. inputYear) and set assigned value to a formula, as follows:
For the + button: IF(pageVars.inputYear<2099, NUMBER(pageVars.inputYear) + 1, 2099)
For the - button: IF(pageVars.inputYear>2021, NUMBER(pageVars.inputYear) - 1, 2021)

Replace the 2021’s in the above function with whatever you want the minimum year to be and the 2099’s with your max year.

1. Then style the cells and icons to suit your taste.

Note that if someone clicks on the year and types a number, they can enter something outside your min & max values. With some logic you can sanitize those as well. Or if you just want -/+ controls and don’t want user to be able to enter a year, set input primitive disable = true (or replace that component with a text component)

2 Likes

Thank you very much, I’ll try this.

Wow, that’s a list of 1000 items. That might be a pain for the user to scroll thru. Might even blow up the app (?).

But here’s a formula you can play with that should generate a list of dropdown values:

MAP(GENERATE_RANGE(200,2000,100), {label: item, value: item})

This goes in your dropdown’s option list. In this example, it starts at 200 and goes up by 100’s until 2000. Edit these values to suit your needs and try it out.

1 Like

Thanks so much I appreciate the help