web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Nested With Statements...
Power Apps
Unanswered

Nested With Statements in Gallery

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have this code running in a Gallery and it seems to be working, but the first time I start the app I get this error:

The value ':' cannot be converted to a date or time value.  ( or see image )

 

It's like it's not ready the with the previous tmpOpenHours lookup With(statment).

Arn't they evaluatet in synchronized order?

 

If I remove WorkMinutes the error do so as well, so it is the cause of it.

 

I tried to revers the order of tmpOpenHours and WorkMinutes  but then the editor shouts at me, soo it seems to want it synchronized.

I can change the source (sharepoint list) to hold the actuall time value like "08:00" instead, but I guess I want to educate myslef and try to understand this.

Any ideas?

 

 

 

With({ tmpLevBookings: Filter(colLeveransBookings7days, RecondDate = DateAdd(varPickedDate, ThisItem.Value, Days) ) },
 With({ tmpRecBookings: Filter(colRecondBookings7days, Date = DateAdd(varPickedDate, ThisItem.Value, Days) ) },
 With( {tmpOpenHours: LookUp(colOpenHours, DayID = Weekday( DateAdd(varPickedDate, ThisItem.Value, Days), StartOfWeek.Monday )) },

 With({ tmpVacancy: Filter(colVacancys, DateStop >= DateAdd(varPickedDate, ThisItem.Value, Days) ) },
 With( {WorkersToday: If(tmpOpenHours.NumOfEmployees - Sum(tmpVacancy, NrOfVacancys) < 0, 0, tmpOpenHours.NumOfEmployees - Sum(tmpVacancy, NrOfVacancys) ) },

 With( {BreakMinutes: tmpOpenHours.BreaksInMin * WorkersToday },

 With( {WorkMinutes: ( DateDiff( TimeValue( tmpOpenHours.StartHour & ":" & tmpOpenHours.StartMin), TimeValue( tmpOpenHours.CloseHour & ":" & tmpOpenHours.CloseMin ), Minutes ) * WorkersToday ) - BreakMinutes },

 With({ tmpLevMinutes: If( Sum(tmpLevBookings, Minutes) = Blank(), 0, Sum(tmpLevBookings, Minutes) ),
 tmpRecMinutes: If( Sum(tmpRecBookings, Minutes) = Blank(), 0, Sum(tmpRecBookings, Minutes) ) },
 With({tmpMinutesLeft: If( WorkMinutes - tmpLevMinutes - tmpRecMinutes - varPickedWashMinutes <= 0, 0, WorkMinutes - tmpLevMinutes - tmpRecMinutes - varPickedWashMinutes ) },
 tmpMinutesLeft
 )
 )
 )
 )
 )
 )
 )
 )
)

 

 

 

value_error.PNG
Categories:
  • BCBuizer Profile Picture
    22,899 Super User 2026 Season 2 on at

    Hi @kmansweden ,

     

    For testing purposes, can you add a label to the gallery that just displays the value for tmpOpenHours, using the With statement you currently have? I have a suspicion something may not go as planned there, but without knowing the details of your app/data sources there's very little focused advice to give.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I got a label in the gallery and it shows the correct value (see image) but still the message shows at first load.

    PS.
    I posted the workaround code in my orginal post, changed it back to the one that produce the error.
    Since I got it working with the workaround its not a big deal, just trying to evolve but thanks for replying. 🙂

     

    value_error_2.PNG

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard