cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JC75NATS
Advocate II
Advocate II

Dynamic URL based on Date table

Hi some help please.

 

I have a button that when clicked will open a website - I want the URL to have dynamic element based on the table below.  So, if today's date was (2021-05-21) it would mean the url would be "HTTPS://WEBSITE/2021-05-20" until the next date range was reached.

 

The Table would be a list in SP, imported as a collection into the app - so as the years pass the dates would change, so solution needs to be dynamic and not require having to change code in app each month/year.

 

I have some ideas - but want it to be as simple as possible.

 

 

Effective Date - YYYY-MM-DD
2021-01-28
2021-02-25
2021-03-25
2021-04-22
2021-05-20
2021-06-17
2021-07-15
2021-08-12
And so on table as values for 2 years
1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

HI @JC75NATS ,

 

I did a test for you.

1\ This is my sharepoint list.

vxiaochenmsft_0-1631606437148.png

 

2\ Add a button control and set its onselect property to:

Clear(Col);ForAll(Sequence(CountRows(LIST169.Test_Date_Column)) As A,Collect(Col,{Id:A.Value,Mydate:Last(FirstN(Sort(LIST169.Test_Date_Column,Test_Date_Column,Ascending),A.Value)).Test_Date_Column}))

 

3\ Add a label control and set its Text property to:

If(LookUp(Col,Today()<ThisRecord.Mydate).Id<>Blank(),LookUp(Col,Id=(LookUp(Col,Today()<ThisRecord.Mydate).Id-1)).Mydate,Last(Col).Mydate)

 

vxiaochenmsft_1-1631606499128.png

 

Best Regards,

Wearsky

 

 

View solution in original post

1 REPLY 1
v-xiaochen-msft
Community Support
Community Support

HI @JC75NATS ,

 

I did a test for you.

1\ This is my sharepoint list.

vxiaochenmsft_0-1631606437148.png

 

2\ Add a button control and set its onselect property to:

Clear(Col);ForAll(Sequence(CountRows(LIST169.Test_Date_Column)) As A,Collect(Col,{Id:A.Value,Mydate:Last(FirstN(Sort(LIST169.Test_Date_Column,Test_Date_Column,Ascending),A.Value)).Test_Date_Column}))

 

3\ Add a label control and set its Text property to:

If(LookUp(Col,Today()<ThisRecord.Mydate).Id<>Blank(),LookUp(Col,Id=(LookUp(Col,Today()<ThisRecord.Mydate).Id-1)).Mydate,Last(Col).Mydate)

 

vxiaochenmsft_1-1631606499128.png

 

Best Regards,

Wearsky

 

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,511)