I have a need to show a blob value of type text/html in an indicator block. Blobparts are an Array. I get an error “Blob not defined” in the code below. I am trying to assign the blob to an attribute in the device which is defined as blob, type text/html
var invStr;
var itemsInList = false;
var i=0;
var blobParts =;
while (itemsInList == false && i < payload.working.facility.length)
{
if (payload.working.facility[i].length > 0)
{
itemsInList = true;
invStr = payload.working.facility[i][0];
blobParts.push("'<html>New PO issued for the following:" + invStr + "'");
blobParts.push("'invStr" + "</html>'");
var POBlob = new Blob(blobParts, {type : 'text/html', endings: "transparent"});
payload.working.invDevice.POTag = POBlob;
}
i++;
}
blob.min.js - how to reference blob constructor in a function node in a workflow?
@Sreyams_Jain1,
Just to help, it looks like you’re trying to use the Javascript Blob. Losant Blobs are different and are reported as base64 encoded strings. Like so:
{
"data" : {
"image": "/9j/4AAQSkZJRgABAQEAYABgAAD//gA7Q1JFQVRPUjogZ2===",
},
"time": <Optional Timestamp>,
"flowVersion": <Optional Workflow Version Name>
}
In your case, if you’re trying to generate blob attribute data within the Function Node, you would need to:
- Generate your HTML (looks like your code accomplishes this).
- Base 64 encode the HTML String
Then, later in your workflow, you can use the base64 encoded HTML string as the data for your blob attribute in the Device State Node.
To address your comment here:
Unfortunately, the Indicator Block doesn’t support HTML. HTML could be displayed in the Custom HTML Block. But that block requires knowledge of HTML, CSS, and JS.
Resource: