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 / If Statement to Update...
Power Apps
Answered

If Statement to Update Collection Not Working if Collection Values are Different

(0) ShareShare
ReportReport
Posted on by

This must be something I'm doing wrong but would love some direction. I have a simple IF statement that uses a toggle switch to determine values in a collection.

 

If(ToggleDrive.Value = false,Collect(colActiveTickets, {colTicketNbr: LblTicket.Text, AssignTime: Now(),driveTime:"", arriveTime:"",troubleshooting:"",custVer:"",issueResolved:""}),Collect(colActiveTickets, {colTicketNbr: LblTicket.Text, AssignTime: Now(),driveTime: Now(), arriveTime:"",troubleshooting:"",custVer:"",issueResolved:""}))

 

Specifically looking at driveTime, if I make the values the same in both TRUE and FALSE, it doesn't give me an error, but if I set the TRUE to driveTime:"" and FALSE to driveTime: Now() it gives me an error. It seems directly related to text versus a time function.

 

Why is this happening?

Categories:
  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @animartis 

    Use Blank() instead, "" forces the data type to Text and you then get the data mismatch, as you have rightly pointed out.

  • animartis Profile Picture
    on at

    Worked like a charm. Thank you kindly!

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 345 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 225

#3
M Bilal Khan Profile Picture

M Bilal Khan 192

Last 30 days Overall leaderboard