cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Toggle Value added to collect

Hello,

 

i've got an issue where i want to use a Toggle, if true then the text is "IN", if false then text is "OUT"

 

i've set the TrueText  = "IN" and Falsetext = "OUT" the output needs to be added to a collect which is then uploaded,

 

the code to build the collect is 

 

 

Collect(collectMultiScan,
{
Direction: Toggle1.Value,
Barcode: BarcodeScanner2.Value,
Time: Now()
}
)

 

the problem i have is the toggle1.value is true or false, and ides how to change it to IN or OUT?

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

thank you, it's now working i added a new button saved and published re-loaded on my phone and it wasn't showing the new button, so closed my session re-applied the code that you posted, saved published and then new version then got loaded correctly and worked

View solution in original post

8 REPLIES 8
eka24
Super User
Super User

Consider this:

Collect(
    collectMultiScan,
    {
        Direction: If(
            Toggle1.Value,
            "IN",
            "OUT"
        ),
        Barcode: BarcodeScanner2.Value,
        Time: Now()
    }
)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Anonymous
Not applicable

added the code i'm now just getting "out" no matter what option is selected on the toggle

I tested the code but it works fine.

Where did you put the Code, also note the name of your Toggle1?

Can you give a screen shot

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Anonymous
Not applicable

alanwilcox_0-1612437794282.png

 

code added to the onscan button, also name is toggle1 

 

Collect(collectMultiScan,
{
Direction: If(
Toggle1.Value,
"IN",
"OUT"),
Barcode: BarcodeScanner2.Value,
Time: Now()
}
)

I see an error on the Formula (Red), have you checked that?

Also copy the formula and try it on OnSelect of a Button if that will work

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Anonymous
Not applicable

error is now gone, still only showing out even is the toggle is set to in

Have tried the formula OnSelect of another button?

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Anonymous
Not applicable

thank you, it's now working i added a new button saved and published re-loaded on my phone and it wasn't showing the new button, so closed my session re-applied the code that you posted, saved published and then new version then got loaded correctly and worked

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,466)