Solved

The "Write file" process action writes the contents of a varbinary(max) process variable encoded as Base64, but only when Indicium is in charge.

  • 6 January 2023
  • 1 reply
  • 111 views

Hi,

This question concerns SF 2021.3 - GUI 2021.3.11.0; separated from our other up-to-date infrastructure and environments.


For some specific reasons, one of our internal tools occasionally requires the data to be imported into other tools (such as Excel, R). Preferably, as a .csv.

Since the standard export functionality in the Windows GUI doesn’t allow you to structure one-to-many and many-to-many relational data, I’ve written a simple process flow that’s designed as follows.

“Start table task export_to_csv” has “Performance → Use process procedure” enabled such that, based on the task parameters, the associated control procedure selects all the table’s data and relational data and saves it to a VARBINARY_MAX process variable called ‘csv_contents’.
 

select @csv_contents_interim = string_agg(qas.regels, char(13)+char(10)) 
from query_as_rows qas

set @csv_contents = (select convert(varbinary(max), @csv_contents_interim))

 

The task also let’s the user specify the save path and the filename to be created, which is saved in a process variable and passed as input.

 

During development as an RDMS user with a smaller dataset, everything worked perfectly. However, after deploying the functionality to a production environment with where the Indicium layer handles everything, I’ve been getting some unexpected output in the resulting file that was written. Most notably that the whole file seems to be base64 encoded (using an IAM authenticated user).


When decoding with e.g. Windows Built-in certutil -decode InFile OutFile command, everything seems to be all right, although some characters seem to be unknown and are represented as specials (Unicode block) in Visual Studio Code. This could be due to the forced UTF-8 encoding.
 

Excel seems to know what character it is though when importing the .csv (e.g. •). 

 

This however doesn’t explain why, when indicium is handling the communication, it outputs the contents of the csv_contents process variable as base64 encoded on a single line. 

4110360 characters on a single line

What are the conditions for this to happen exactly; and how can this be solved?

Thank you in advance,

pkostic

 

icon

Best answer by Roel 9 January 2023, 14:24

View original

This topic has been closed for comments

1 reply

Userlevel 4
Badge +1

Hello,

 

This is a Windows GUI issue where the returned base64 is not correctly converted to a byte array before the Write File action is executed.

It would be nice if you could submit a ticket in TCP so we can plan and resolve this matter asap.

 

Kind Regards,

Roel