cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alanwilcox
New Member

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

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 III
Super User III

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.

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.

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.

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.

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

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (74,194)