cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
VictorSotnikov
Helper II
Helper II

A Text Input component and a correspodning NULLable SQL column

I have a Canvas app with a Form. The Form contains a Data Card with a Text Input component inside. The Data Card is bound to an SQL table MyTable, column MyColumn [nvarchar](255) NULL.

Let’s imagine that an end-user modifies the Text Input component; and the component becomes empty in the end; then saves the Form.

What would be put into MyTable.MyColumn: NULL or an empty string? Is there any way to manage this behavior?

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@VictorSotnikov 

You will get an empty string.

You can control it by intercepting in the Update property of your datacard.

i.e.

If(IsBlank(yourTextInput.Text), Blank(), yourTextInput.Text)

Note: you will need to make sure you have the Formula level error management feature turned on in your app.

 

Also, sometimes the null will be in the TextInput and get interpreted as "" instead of Blank.  So the following change to the above will resolve that:

If(IsBlank(Trim(yourTextInput.Text)), Blank(), yourTextInput.Text)

The introduction of the Trim function will ensure a proper value to the IsBlank.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

1 REPLY 1
RandyHayes
Super User
Super User

@VictorSotnikov 

You will get an empty string.

You can control it by intercepting in the Update property of your datacard.

i.e.

If(IsBlank(yourTextInput.Text), Blank(), yourTextInput.Text)

Note: you will need to make sure you have the Formula level error management feature turned on in your app.

 

Also, sometimes the null will be in the TextInput and get interpreted as "" instead of Blank.  So the following change to the above will resolve that:

If(IsBlank(Trim(yourTextInput.Text)), Blank(), yourTextInput.Text)

The introduction of the Trim function will ensure a proper value to the IsBlank.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,615)