IfError Function in Power app

Loading

Requirement: Example of IfError function in Power apps

IfError– The IfError function tests values until it finds an error. If the function discovers an error, the function evaluates and returns a corresponding replacement value and stops further evaluation. A default value can also be supplied for when no errors are found. The structure of IfError resembles that of the If function: IfError tests for errors, while If tests for true.

Insert Label and Text input controls on the screen, Add the below formula on Text Property of Label:

IfError( Value( TextInput8.Text ), -1 )

In TextInput8, enter 89765.Label45 will show the value 89765 as this is a valid input to the Value function.

In TextInput8, enter ToInfinity. Label45 will show the value -1 as this isn’t a valid input to the Value function. Without wrapping the Value function with IfError, the label would show no value as the error value is treated as a blank.

Leave a Reply

Your email address will not be published. Required fields are marked *