cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
OliverV
Helper I
Helper I

collect calendar week days

Hi All,

 

I'm quite stucked with an app developement. I had a version of an app built on sharepoint list. In the sharepoint lists i created a separate list containing 2020 dates with week day name, week day numbers.

 

In the canvas app i had a dropdown conatining the week numbers (1-53), and by selecting an item i was collecting only the data of the specific selected week (to use afterwards in other points of the app).

Now I'm testing the rebuild of this app in a CDS environment, and i would need the same funcionality.

what i'm stucked with is this "Week selection" part. The date picker is not usable for this, because there on click i select 1-1 day. I wouldn't like to create a date dimension in the CDS for this. Any idea for the workaround?

 

Thx in advance!

Oliver

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @OliverV :

Do you want to get the corresponding dates through weeknumber?

I think this can be achieved by the dateadd function.

I assume that 2019/12/29 (Sunday)-2020/1/4 (Saturday) is the first week.

1\Add a dropdown control(Dropdown2)

Items:

 

[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18……]

 

OnChange:

 

Set(
    startdate,/*startdate is my custom variable that used to store the start date of the week*/
    DateAdd(
        Date(
            2019,
            12,
            29
        ),
        (Value(Dropdown2.SelectedText.Value) - 1) * 7,
        Days
    )
);
Set(
    enddate,/*enddate is my custom variable that used to store the end date of the week*/
    DateAdd(
        Date(
            2019,
            12,
            29
        ),
        (Value(Dropdown2.SelectedText.Value) - 1) * 7 + 6,
        Days
    )
)

 

When the options in the dropdown control change, the two variables (startdate/enddate) change accordingly.

10.gif

Best Regards,

Bof

 

View solution in original post

1 REPLY 1
v-bofeng-msft
Community Support
Community Support

Hi @OliverV :

Do you want to get the corresponding dates through weeknumber?

I think this can be achieved by the dateadd function.

I assume that 2019/12/29 (Sunday)-2020/1/4 (Saturday) is the first week.

1\Add a dropdown control(Dropdown2)

Items:

 

[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18……]

 

OnChange:

 

Set(
    startdate,/*startdate is my custom variable that used to store the start date of the week*/
    DateAdd(
        Date(
            2019,
            12,
            29
        ),
        (Value(Dropdown2.SelectedText.Value) - 1) * 7,
        Days
    )
);
Set(
    enddate,/*enddate is my custom variable that used to store the end date of the week*/
    DateAdd(
        Date(
            2019,
            12,
            29
        ),
        (Value(Dropdown2.SelectedText.Value) - 1) * 7 + 6,
        Days
    )
)

 

When the options in the dropdown control change, the two variables (startdate/enddate) change accordingly.

10.gif

Best Regards,

Bof

 

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (48,158)