Unable to set column of type image to empty in DBTreeView

Hi All

I am unable to fill in programmatically an icon as empty in a DBTreeView bean.

Column name: icon : type is image (Database SQL Anywhere 10)

When the bindig to the icon was made in the bean setup, there is by default an empty icon inserted (icon is a sheet of paper). I can suppress that with the SQL stmt for example:

UPDATE school_units set icon = ‘’
where id = 44;

Works perfect, i. e. the icon is not shown any more.

Now I do that on entering a new record with the JavaScript line:

icon = ‘’;

Doesn’t work, i. e. the column value is null, hence the empty icon is shown.

That means the ‘’ in JavaScript is not equivalent with the ‘’ in a SQL statement.

Anyone knows the equivalent in JavaScript?

Best regards, Robert

PS: The DBTreeView shown in attachment as example:
Row Maturitätsschule with icon = empty
Row yyy with icon = null, i. e. showing as defautl (white sheet of paper)

Have your tried:

icon = new String();

I don’t know the SQL Servoy will generate on that, but at least icon won’t be null.

Hope this helps,

If nothing else works you could consider using a 1x1 px transparent png image as workaround
It won’t hurt the speed (size-wise) and it’ll solve your problem…

In any case file a bug report for this because if you set an empty string to a dataprovider then you don’t want it to store a NULL.
An empty string is not equal to a NULL, in any language ;)

Setting empty strings to a blob column can cause errors in many environments (for example you get an error if you do that with .NET and SQL Server). I find it a bit strange, anyway, to assign an empty string to a blob column…

Oh, wait. A BLOB column ? I thought this was a text column.

Hi Marc

I was looking for a better solution .-) But I know it’s common in HTML programming…

Regards, Robert

mboegem:
If nothing else works you could consider using a 1x1 px transparent png image as workaround
It won’t hurt the speed (size-wise) and it’ll solve your problem…

I absolutely agree with your conclusion, did I say otherwise? I hope not :D

ROCLASI:
In any case file a bug report for this because if you set an empty string to a dataprovider then you don’t want it to store a NULL.
An empty string is not equal to a NULL, in any language ;)

Hi Patrick

I do not want to assign a string to an image type column, but I am looking for the equivalent of an empty (not null) image (first sentence in my original post) and couldn’t find one till now.
But I still hope to find it :)

Regards, Robert

patrick:
Setting empty strings to a blob column can cause errors in many environments (for example you get an error if you do that with .NET and SQL Server). I find it a bit strange, anyway, to assign an empty string to a blob column…

No, it’s a column of type image (in SQL Anywhere)

ROCLASI:
Oh, wait. A BLOB column ? I thought this was a text column.

But that is basically the same! According to Sybase:

The IMAGE data type is used to store binary data of arbitrary length

Empty Strings are not exactly that.

Hi Patrick, your idea does not work, either. Thanks, Robert

ptalbot:
Have your tried:

icon = new String();

I don’t know the SQL Servoy will generate on that, but at least icon won’t be null.

Hope this helps,

I completely agree with you, Patrick, but what is the (Hex) code of an empty image, so I do NOT get the default icon of the DBTreeView bean? I tried some variant of 0x00 etc., but nothing works so far. And I am asking myself how I exactly would make an empty media which is not at least 1 px width as suggest by Marc. If I can set it with an SQL command, it should be possible to assign a value to the icon column with just that. I only can’t decode the ‘’ entered with SQL, if I would find a way that would be the solution.

Thanks, Robert

patrick:
But that is basically the same! According to Sybase:

The IMAGE data type is used to store binary data of arbitrary length

Empty Strings are not exactly that.

Hi All

I noticed that I am not able to assign ANY media to a database field. As with other database columns of datatype integer or varchar, for example, I try to assign the db column icon of datatype image this:

icon = "media:///icnTransparent1x16.png";

But it doesn’t work!? What’s wrong here?

Any help very appreciated, Robert

What you are assigning is a string. You have to make sure that you are passing a byte. So in your case you should do something like

icon = plugins.http.getMediaData('media:///yourImage.png');

Hi Patrick

That was it - thanks a lot! One step further :D
I am assigning a transparent image of size 1 px width x 16 px height. This in fact needs (measured on the screen) 2 px width, for whatever reason!?
Now, if I only knew how to assign an “empty” image which does not consume any width in the DBTreeView row at all, like when I insert an “empty” image into the row with the SQL stmt

update school_units
set icon = ‘’
where id =

This does not consume any width, except the default indent, of course.

Best regards, Robert

PS: BTW, is my assumption correct that we can’t control the indentation in DBTreeView? Did anybody make a request for that already?

Just leaving your blob struggles aside: what exactly do you want to do?

I just want to waste as little horizontal space per (inserted) row as possible. And I do not want to have the default paper or folder icon to be displayed in the tree. As the indent is already quite big, I do not want to loose even more space. That’s all I try to achieve.

Best regards, Robert

patrick:
Just leaving your blob struggles aside: what exactly do you want to do?

Is it that you don’t want any icons at all or just in some cases (for some nodes)?

For one DBTreeView I do not want icons at all, for the other one it’s mixed, i. e. some nodes have an icon, some don’t.

patrick:
Is it that you don’t want any icons at all or just in some cases (for some nodes)?