Question

Handling binary data in business processes

I have an entity with a BLOB column. In a script task I get a C# byte array. Now I would like to save that array in the object using Add data block. The problem is that I don't know how to pass that data since I cannot find any process parameter type for binary data.

As an alternative I tried to convert the binary data to Base64 and save it in Unlimited length text column. In this case the problem was that the unlimited length column was limited and only part of the string got saved to the database.

Do you know how to deal with those problems?

Like 0

Like

2 comments

if the process is interpreted then use in scriptask method

Set ("component name. Property name", value)

The value needs to be serialeze to string

But it is better to use InsertQuery or UpdateQuery or esq as

Stream stream = new MemoryStream(UTF8Encoding.UTF8.GetBytes(serializedString));
stream.Position = 0;
var manager = UserConnection.GetSchemaManager("EntitySchemaManager") as Terrasoft.Core.Entities.EntitySchemaManager;
	var entitySchema = manager.GetInstanceByName("FileContactVisa");
	Entity entity = entitySchema.CreateEntity(UserConnection);
	var valueColumn = entitySchema.Columns.GetByUId(StoringColumnUId);
	entity.SetStreamValue("Blob", stream);
	entity.Save();
 
or
 
var _caseFile = new Terrasoft.Configuration.CaseFile(UserConnection);
_caseFile.FetchFromDB(recordId); 
_caseFile.SetStreamValue("Blob", memo);
_caseFile.Save();

 

Grigoriy,

Ok, I used ESQ. Thanks.

Show all comments