cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gme-eg
Helper IV
Helper IV

Year collection run manually

Hi everybody

I created  year collection and linked it to a drop down that contains formula when the user open the app the year will be displayed automatically on the current year.

 

Years Collection button on select formula:

Collect( Years, { ID: "1", Value: 2019 }, { ID: "2", Value: 2020 }, { ID: "3", Value: 2021 })

 

Dropdown Items "Years"

Default

LookUp(
    Years,
    Value = Year(Now())
).Value

the issue now every time I open the app I should click on the collection button to run it, please I need it automatically anyone can help?

 

1 ACCEPTED SOLUTION

Accepted Solutions

@WarrenBelz  is correct; to have the Collection automatically be set, you will want to use the app's OnStart property and load the collection there. Note, it will execute automatically the first time you edit in the Studio, but must be toggled afterwards. Normal app loads will run the function as expected.

 

I can't tell the exact behavior you're expecting, but here are guesses:

  1. [Most Likely] The Dropdown has the current year selected when a User sees the control
  2. The Dropdown should be blank until a User clicks on the control, then it sets the current year
  3. Some other manual click from the User to create the collection, then default the Dropdown

 

If you're looking for the standard default, your formula looks correct. However, you need to correlate the Value property of the Dropdown to what the Default is passing. See screenshot:

DropdownControlDefault.png

The Value list on the property pane for the Dropdown shows the available fields, from the Items being passed to the Dropdown. It's not a property you can set, but you can select it here. Yours might be set to ID. Replicating the above will give you a Defaulted year value in the Dropdown.

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @gme-eg ,

You can run it at App OnStart - this will run every time the app is openedOnStart.jpg



 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Thanks a lot for support but it is still needs to be manually also I run it from the app and I added it to the app on select formula

@WarrenBelz  is correct; to have the Collection automatically be set, you will want to use the app's OnStart property and load the collection there. Note, it will execute automatically the first time you edit in the Studio, but must be toggled afterwards. Normal app loads will run the function as expected.

 

I can't tell the exact behavior you're expecting, but here are guesses:

  1. [Most Likely] The Dropdown has the current year selected when a User sees the control
  2. The Dropdown should be blank until a User clicks on the control, then it sets the current year
  3. Some other manual click from the User to create the collection, then default the Dropdown

 

If you're looking for the standard default, your formula looks correct. However, you need to correlate the Value property of the Dropdown to what the Default is passing. See screenshot:

DropdownControlDefault.png

The Value list on the property pane for the Dropdown shows the available fields, from the Items being passed to the Dropdown. It's not a property you can set, but you can select it here. Yours might be set to ID. Replicating the above will give you a Defaulted year value in the Dropdown.

View solution in original post

Please what @WarrenBelz is the way to go if you want it automatically done instead of manually as you want. Put it Onstart as he said
WarrenBelz
Super User
Super User

Thanks @GarethPrisk 

One small small thing to add - you can run App OnStart during developmentAppOnStart.jpg

 

 

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (985)