Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Value function converted an empty text to a blank value (text box in gallery control)

Posted on by 18

Hi. I'm receiving this warning when performing validation of the user's data entered into a text box control in a gallery. The text box control is set up with the format property of 'Number' instead of text. The text box is used to collect a number between 0 and 100. I am using conditional formatting in the Color property to evaluate the number that's provided and then apply a red colour to the text if the number entered is <0 or >100 (or indeed '!IsNumeric' which shouldn't be possible with the Number format).

 

In the Monitor I see warnings (see attached example) several times when the Color property of this control is being evaluated. I've tried catching this with OnError, or using Coalesce to force a "0" value, or using an If command to pass "0". Nothing I've tried so far has worked. I know there are a few forum posts on this issue already but none of the suggested fixes have worked for me...

 

Any other suggestions please?

 

Below is an example of the code I've tried to resolve this.

=========================

 

If(
If(
Self.Text = Blank(),
0,
Value(Self.Text)
) > 100 ||
If(
Self.Text = Blank(),
0,
Value(Self.Text)
) < 0 ||
!IsNumeric(
If(
Self.Text = Blank(),
0,
Value(Self.Text)
)
),
Color.Red,
RGBA(
255,
255,
255,
100
)
)
//Coalesce(
// Value(Self.Text),
// 0
// )

 

Attached is an image showing the warning. Click to expand.

Screenshot 2023-08-18 185029.png

  • jamezm79 Profile Picture
    jamezm79 18 on at
    Re: Value function converted an empty text to a blank value (text box in gallery control)

    Thank you! This really helps. I no longer seem to get the warning for those particular text boxes.

     

    Any tips for making a similar correction to a related text box that calculates the sum of all of those percentage totals in the gallery? The formula for that text box is currently:

     

    Sum(galleryGrid.AllItems,txtPercentage)

  • Verified answer
    developerAJ Profile Picture
    developerAJ 2,801 on at
    Re: Value function converted an empty text to a blank value (text box in gallery control)
    If(
    If(
    IsBlank(Self.Text),
    0,
    Value(Self.Text)
    ) > 100 ||
    If(
     IsBlank(Self.Text),
    0,
    Value(Self.Text)
    ) < 0 ||
    !IsNumeric(
    If(
    IsBlank(Self.Text),
    0,
    Value(Self.Text)
    )
    ),
    Color.Red,
    RGBA(
    255,
    255,
    255,
    100
    )
    )

     

    or

    If(
    Coalesce(
    Value(Self.Text),
    0
    ) > 100 ||
     Coalesce(
    Value(Self.Text),
    0
    ) < 0 ||
    !IsNumeric(
    Coalesce(
    Value(Self.Text),
    0
    )
    ),
    Color.Red,
    RGBA(
    255,
    255,
    255,
    100
    )
    )

     

    both should work

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,487

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,014

Leaderboard