Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi, all,
I have a byte array (image) in json format in sql db. I extract the image out and also in json format. my query is:
SELECT thumbNail FROM Table
cross apply openjson(CMD_LIST,'$.queueMessagePages')
with
(pageNo Int '$.pageNo',
[thumbNail] nvarchar(max) as JSON
) as jsonsvalues where ...
Then I get the thumbnail in nvarchar(max).
In the report builder, I customize a function to convert the byte array into hex string. the function is like:
Function ToHexString(ByVal bytes() As Integer) As String
Dim strB As New System.Text.StringBuilder
Dim ints(bytes.Length) As Integer
Dim N as long
For N = 0 To bytes.Length - 1
If bytes(N) < 0 Then
ints(N) = bytes(N) + 256
Else
ints(N) = bytes(N)
End If
Next
For N = 0 To ints.Length - 1
If ints(N) < 16 Then
strB.Append("0" & Hex$(ints(N)))
Else
strB.Append(Hex$(ints(N)))
End If
Next
ToHexString ="0x" & Replace(strB.ToString().ToUpper(), " ", "")
Return ToHexString
End
I tried to run this function in vb,net can get the hex string correctly. but cannot get the image in report builder.
Please help to visualize the image in report builder if you have any experience. Thank you!
The rdl supports Byte Array so you do not need to convert to hex! We have been converting the hex to bytearray if at all! Try to put this on a Dataset field and bind that to the image control. Also just to make sure the image mime is as of the original one.
Thank you for your reply. but my byte array is saved as varchar(max) in database, it is a string with byte array value. is it still ok for report builder to visualize it?
Yeah it should work! try adding this convert
Convert.FromBase64String
I tried add the convert and not add, but both not work for me.
Hi, @Tengmin123
After my search, I'm afraid that vb language is not supported .
Sorry, I have no experience in this area. I only used the following method to add images to the desktop. You can reference:
How to upload multiple images to SQL Server (sqlshack.com)
Best Regards
Janey Guo
Thank you for your reply.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
5 | |
4 | |
2 | |
2 | |
1 |
User | Count |
---|---|
7 | |
6 | |
6 | |
4 | |
3 |