cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tianaranjo
Continued Contributor
Continued Contributor

Numeric - Decimal

Greetings, 

 

I am patching a numeric value to a collection.  In some cases, I will need to add a decimal.  Any advice on how I can modify the below statement to include a decimal if the user selects with the text set to ".".

 

    Patch(
        colKeypadSelectOrder3,
        LookUp(
            colKeypadSelectOrder3,
            Result = fieldSelected
        ),
        {
            Value: 
           
                (LookUp(
                colKeypadSelectOrder3,
                Result = fieldSelected,
                Value
            ) & Value(btnNumKey.Text) * 1)
                }
    )
)
1 ACCEPTED SOLUTION

Accepted Solutions

OK, you are actually working with text and not numbers since you use the & operator.  The values stored in your collection are text.

Hence you should just forget about Value and * 1 then the . will be added.

Something like this:

Patch(
        colKeypadSelectOrder3,
        LookUp(
            colKeypadSelectOrder3,
            Result = fieldSelected
        ),
        {
            Value: 
           
                (LookUp(
                colKeypadSelectOrder3,
                Result = fieldSelected,
                Value
            ) & btnNumKey.Text)
                }
    )
)

However this will not prevent people from adding two or three .'s

 

For this you will need to check if there is a . present and disable the . button for example

View solution in original post

6 REPLIES 6
Meneghino
Community Champion
Community Champion

The Value() function has a second argument to define how to convert text to numbers.

If you set the second parameter to "en-US" for example, any '.' will be seen as a decimal separator.

If the second parameter is set to "it-IT" for example then the decimal separator will be a ','

tianaranjo
Continued Contributor
Continued Contributor

@Meneghino Thank you for the immediate reply! 

 

With that in mind, can you recommend how I modify the patch statement to receive the decimal as input if a user selects the button?  

Difficult to say without knowing more about how your app works.

What is btnNumKey.Text?

Why do you multiply by 1?

tianaranjo
Continued Contributor
Continued Contributor

@Meneghino I am using a numeric keypad for numeric entries in the app.  btnNumKey.text is the value of the button selected and * 1 is used to basically convert the text into a value.  

 

Hope this helps.

 

OK, you are actually working with text and not numbers since you use the & operator.  The values stored in your collection are text.

Hence you should just forget about Value and * 1 then the . will be added.

Something like this:

Patch(
        colKeypadSelectOrder3,
        LookUp(
            colKeypadSelectOrder3,
            Result = fieldSelected
        ),
        {
            Value: 
           
                (LookUp(
                colKeypadSelectOrder3,
                Result = fieldSelected,
                Value
            ) & btnNumKey.Text)
                }
    )
)

However this will not prevent people from adding two or three .'s

 

For this you will need to check if there is a . present and disable the . button for example

tianaranjo
Continued Contributor
Continued Contributor

@Meneghino

 

Thanks!  You've been a great help.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (3,901)