What is the return value of an empty textbox Text?

sorry i mean 'a,,c'

As I believe we have collectively indicated, this will return a string compatible with a mySQL query

image

1 Like

what i am saying that 'a,,c' is the problem for mysql input for my purpose. No problem updating mysql, but when get this updated entry, it behaves as if the column between a and c does not exist, so it returns only 2 elements instead of three that I expected

BTW, how do you get the question mark on the blocks so that they show you the 'do it result'? Thanks

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

2 Likes

Work in companion app, then you can right click on a block and select "Do It". This outputs to the comment box and presents the ? icon to turn the comment on and off.

3 Likes

I prefer to avoid problems like this, in the table design stage.

If you take those columns in table x that might have null values in them (b, b1,...) and create new tables (xb, xb1, ...) just for your old table key (a?) and the optional column, you can transform a null test into a row existence test. Just don't add a row (a,b) to table xb if b is null. Remove column b from your original table x, leaving just required columns in table x.

This would require extra table access for the optional column tables, but it would eliminate worries about null values.

Alternatively, use an application-specific null value like the word 'NULL' or the number -1 for a positive numerical domain. But then you have to explicitly test for the application-specific null value when working with that optional column.

1 Like

"outside of strict mode, NOT NULL in MySQL actually means the column will never store nor return a null.", that maybe the issue. I should make the columns "Null", so where there's nothing, it returns Null, which will be considered a value for the column so that there will be no error.

2 Likes

a related question, how to evaluate whether any element in a list is empty? i am trying to use 'is in list, thing:list', what do i put for 'thing' if the thing is empty? "null"?

Show us an example of an empty element.

  • empty text block?
  • empty list ?

grafik

As I said:

i tried to use that, but not sure. Will update if anything wrong. Thanks alot!

alternatively...

image

note: number blocks can't be empty

1 Like

then how to evaluate a list whether it contains all empty elements? like ['','','','',''] Thanks

You use counting and indexes (and probably another list....)

why not use "is in list thing:list" using 'not' and a 'empty string'? Strangely an empty string block cannot dock to the not block. Any walkaround?

Once you have mastered the value procedure sandwich (procedure,local variables, do with result) you can make these easily.

1 Like

The not block only accepts logical values. A text block will not pass that test.
Hamlet
(Thank you, Hamlet)

There is a logical test for every data type and common condition. Just typeblock is...
Depends on what is is

2 Likes

2 Likes

Thanks everyone for the response. let's go back to my original task. Again, I'm updating mysql db with a value of an empty string from a textbox, but when i use GET to query that value, it does not return an empty string. instead it behaves like the column does not exist, therefore, the value is simply missing (no empty string, no Null value). I tried NULLIF(column, ''), still the same. I found an imperfect solution for my specific purpose: I assign the textbox a default value of a white space. This works fine with GET query, though practical, but as I said this is not an ideal solution.