cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RDJHUD
Regular Visitor

Create a date field that auto calculates based on another date field

I am setting up a CDS entity for an app I'm creating.  I have several date fields that I'm putting in statically, but I have some date fields that will need to be calculated off of another field.  So, I create Field A in my entity and it's a date picker.  I then need to create another field that automatically calculates 120 days after the date selected in Field A.  Is there a way to do this?  I have seen references to some ways that have to do with coding, but honestly I'm new to Power Apps and CDS, so I'm not sure where to begin actually inserting that coding as I don't see any "custom" fields that accept the coding.  I'm probably missing something when it comes to that, so forgive my ignorance.  I have no problem coding, I studied coding in college and have done minor coding projects, but I am NOT a developer...which is why I like the "low code" environment here.

 

Thanks, 
Randy

2 ACCEPTED SOLUTIONS

Accepted Solutions
ChrisPiasecki
Super User
Super User

Hi @RDJHUD,

A calculated field should do the trick. In the Action, the expression would use the date function:

ADDDAYS(120, 'Field A')

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

View solution in original post

EricRegnier
Super User II
Super User II

Hi @RDJHUD

 

EDIT: I didn't see @ChrisPiasecki post. It is the same as mine, so please discard this.

 

You can also do this out-of-the-box with calculated fields which I recommend to simplify your app's logic and ability to use it for future needs if required. Here's an example (replace createdon with field A):

 

2020-11-08_20-53-44.png

Hope this helps!

View solution in original post

3 REPLIES 3
ChrisPiasecki
Super User
Super User

Hi @RDJHUD,

A calculated field should do the trick. In the Action, the expression would use the date function:

ADDDAYS(120, 'Field A')

---
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

View solution in original post

EricRegnier
Super User II
Super User II

Hi @RDJHUD

 

EDIT: I didn't see @ChrisPiasecki post. It is the same as mine, so please discard this.

 

You can also do this out-of-the-box with calculated fields which I recommend to simplify your app's logic and ability to use it for future needs if required. Here's an example (replace createdon with field A):

 

2020-11-08_20-53-44.png

Hope this helps!

View solution in original post

RDJHUD
Regular Visitor

Thanks to both of you.  I think I was going about this all wrong.  I was trying to do this all in the actual CDS entity, not in the canvas app.  But, now that I think about it and your input it makes sense.  Your input will help me once I move on to making the app. Thanks!  Randy

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

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

Top Solution Authors
Users online (58,648)