Categories > TinyButStrong general >

Alternative for NULL values of a block variable

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Beowolve
Date: 2013-07-15
Time: 18:30

Alternative for NULL values of a block variable

src="[playersblock.image_id;if [val]!=null;then 'scripts/image.php?image_id=[playersblock.image_id]&maxh=30';else 'images/default.png']"

Hi all,
can anyone tell me how it is possible to do something like the above.
This does not work :(.
By: Sarah Kemp
Date: 2013-07-15
Time: 19:03

Re: Alternative for NULL values of a block variable

By: Beowolve
Date: 2013-07-15
Time: 19:46

Re: Alternative for NULL values of a block variable

nodata is not what I want, this would work if the playerblock is empty. But that is not the case, its just the image_id might be null if not yet initialized.
By: Sarah Kemp
Date: 2013-07-15
Time: 19:57

Re: Alternative for NULL values of a block variable

Perhaps it would be easier to initialize the playersblock.image_id to 'images/default.png'?

I don't know about using field conditionals with blocks, but since you are reading a field from the block, maybe ifempty would work for you?
By: Beowolve
Date: 2013-07-16
Time: 14:05

Re: Alternative for NULL values of a block variable

I solved the problem using '' instead of null, thx for the input, found that while looking for a ifempty solution :)

src="[playersblock.image_id;if [val]!=null;then 'scripts/image.php?image_id=[playersblock.image_id]&maxh=30';else 'images/default.png']"