cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
David0094
Frequent Visitor

DateAdd - want to calculate next date based on months indicated in another text field

Hi, I need help, been struggling to identify any syntax error.

 

I have a text input (TextInput1) which lookup the number of months from user selection.

 

From there I would like to calculate the next eligible date for the user to exchange the item. The next eligible exchange date is calculated based on user lastissueddate + textInput1

 

On the Next Eligible Exchange Date date picker, I am trying to set the default date to DateAdd(lastissueddate .SelectedDate, Value(TextInput1.Text), Months). However, it keep receive There is an error in this formula. But I can't the error.

 

can anyone help me? 

1 ACCEPTED SOLUTION

Accepted Solutions
BCLS776
Super User
Super User

Check out the definelifespan control/card. Something in its Default is using creating a loop with DataCardValue153:

BCLS776_0-1634913172161.png

One is calculating off of the other, and then that one is calculating off the first one.

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

10 REPLIES 10
BCLS776
Super User
Super User

Can you share the error message? It's not clear from the info so far what is causing the problem for you.

 

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Hi Bryan,

 

The error message is

 

Capture.PNG

BCLS776
Super User
Super User

Hmm, the error message didn't tell us much. I can get a statement very similar to yours to work on my own test app, so there is no problem with your syntax.

Could you re-type your code, allowing the Intellisense feature to autofill as much of the expression as possible? Sometimes this helps Power Apps correctly reference the values from the controls.

 

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

not sure this message able to help?

 

Untitled.png


@David0094 wrote:

not sure this message able to help?

 

Untitled.png


That message definitely points to a problem. It looks like you are putting your code in the default property of this control and it is conflicting with the default date in the card numbered 153 - they refer to each other and are trying to calculate off of one another. You could edit the DefaultDate on DataCardValue153 so that it refers to something else, such as Today() or another date from a data source.

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Sorry, I am not understand.  I checked the control. I have put my code into default date of DataCardValue153 coz I want to display next eligible date to the user. 

 

I should put the code somewhere else?

 

Untitled.png

BCLS776
Super User
Super User

Check out the definelifespan control/card. Something in its Default is using creating a loop with DataCardValue153:

BCLS776_0-1634913172161.png

One is calculating off of the other, and then that one is calculating off the first one.

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Hi Bryan, thanks for the advice and found mistake. I have recode and now can calculate the date 😀


@David0094 wrote:

Hi Bryan, thanks for the advice and found mistake. I have recode and now can calculate the date 😀


Great to hear - can you share what worked for you and Accept as Solution on the appropriate post? That helps others with similar issues find a solution too.

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,901)