cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

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

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Resident Rockstar
Resident Rockstar

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

@animartis 

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

View solution in original post

2 REPLIES 2
Highlighted
Resident Rockstar
Resident Rockstar

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

@animartis 

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

View solution in original post

Highlighted
Helper II
Helper II

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

Worked like a charm. Thank you kindly!

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (10,642)