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

View solution in original post

tianaranjo
Continued Contributor
Continued Contributor

@Meneghino

 

Thanks!  You've been a great help.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,355)