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 Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (5,564)