• 0

SQL Server - Select a blank image if field is null.


Question

I'm working on a project that uses Infragistics NetAdvantage Reporting to generate a report. The fields on the report are populated from a database using a stored procedure.

 

My problem is that one of the fields on the report is an image, and not all records in the database have a picture and if the field is NULL or invalid Infragistics puts a red X on the report. I need it to just be blank.

 

I'm trying to use something like this:

CASE WHEN Signature IS NULL THEN CONVERT(VARBINARY(MAX), 0) ELSE Signature END AS Signature

However this still results in a Red X if the Signature field is NULL. Is there some way to alter the statement so it will select a valid-but-blank image from the table?

 

5 answers to this question

Recommended Posts

  • 0

Have you tried using the ISNULL function, to provide an alternative value when the primary is null?

 

I'm not familiar with NetAdvantage Reporting, I tend to use T-SQL mostly, but a simple ISNULL should work fine..

 

SELECT   ISNULL(Signature, CONVERT(VARBINARY(MAX), 0)) AS Signature
FROM table
  • 0

The problem with returning a single zero byte when the field is null is that is still not a valid image any more than no data and would still produce a red X I'd assume. You'd probably need to use ISNULL to return a valid 1x1 res image.

 

possibly like this.

 

ISNULL(ColumnName, CAST(0x424d42000000000000003e0000002800000001000000010000000100010000000000040000000000000000000000000000000000000000000000ffffff008000000000 as varbinary(max)))

 

that should be the hex for a monochrome white 1x1 res bmp.

  • 0

Update: I got this working using a "Visibility" property on the report field I hadn't noticed originally.

 

It allows you to define a boolean statement to determine whether the image field will be shown or not, standard stuff.

  • Like 1
This topic is now closed to further replies.
  • Posts

    • I don't know, I haven't checked what changed in previous sockets. I agree that the 1156-1155-1151 succession was suspicious, with a reduction in pin count every time. Intel could do a better job of pre-allocating pins for future use. Another hypothesis is that the internal layout of their CPUs change, like the I/O is moved from one place to another on the chip, and they need to reorganize pins rather than having circuitry go into spaghetti mode to remain compatible. I agree that if AMD is able to maintain compatibility, Intel should be able to do the same, at least by reserving pins for future use and then using those pins when a need for them arises. However, I wouldn't say that AMD's products are entirely better. Intel's I/O now slightly edges out thanks to having double the bandwidth to the chipset and dedicated Thunderbolt lanes to the CPU. It seems that they could widen their lead with the next platform. NVMe SSDs have increased the need for PCIe lanes significantly, and AM5 has been pretty underwhelming in that regard, especially because the chipset connection is so narrow and gets saturated with just 1 gen 4 SSD, leaving the other chipset connectivity (Ethernet, Wi-Fi, audio, etc) to hope for any remaining bandwidth. Otherwise motherboard manufacturers could also make more x2 M.2 slots, those would be fast enough at gen 5 speeds and possibly at gen 4 speeds too.
    • Exactly, the E-cores actually give you good performance for what they offer, it's no surprise that Intel is doubling down on more E-cores instead of more P-cores. The LP-cores are good for when you're system is just sitting there idle and waiting to be used. Every core has it's place tbh, it's just up to Intel to and MS to work to get the scheduler right.
  • Recent Achievements

    • Week One Done
      korostelev earned a badge
      Week One Done
    • Week One Done
      rozermack875 earned a badge
      Week One Done
    • Week One Done
      oneworldtechnologies earned a badge
      Week One Done
    • Veteran
      matthiew went up a rank
      Veteran
    • Enthusiast
      Motoman26 went up a rank
      Enthusiast
  • Popular Contributors

    1. 1
      +primortal
      675
    2. 2
      ATLien_0
      264
    3. 3
      Michael Scrip
      184
    4. 4
      +FloatingFatMan
      177
    5. 5
      Steven P.
      140
  • Tell a friend

    Love Neowin? Tell a friend!