Option to Append to a File

I believe there may be others out there that would like to write results to an existing file by appending the data to the end of the file. Currently in EM, it seems the only options are to overwrite or to halt if the file already exists. Is there anyone else who thinks the capability to append data to a file would be useful?

Hi Casey,

Do you have a specific file format in mind? Because appending is already possible for certain file formats such as CSV.

I was thinking about it when I was trying to develop an easy way to dynamically generate a JSON file by iterating values through that would be separate facts in a Teams card. An existing JSON file template that contained all of the first part of the script, a second table that iterated the various facts (see below) and appended to the JSON file and then a third table that would provide the closing items necessary for the JSON file. That sparked my question.

“facts”: [
{
“name”: “First Item:”,
“value”: “{Parameter}”
},
{
“name”: “Second Item:”,
“value”: “{Parameter}”
},
{
“name”: “Third Item:”,
“value”: “{Parameter}”
}
],

In this case, no need to append JSON from different parts as text. The “Construct JSON” can handle it in a nice and simple way. It can handle JSON arrays and JSON objects of any complexity. See an example: Example: Constructing JSON - #6 by dgudkov

Hi Dmitry,

Thanks for the example. I took it and expanded on it and have the base results I am looking for:

I am working now to understand all of the options I have for formatting, images, etc., but for now we will automatically post projects uploaded to the forum in our EasyMorph User’s Group channel.

My project uploaded in case you want to look at it.

Thanks!

Get EM Community Projects.morph (26.6 KB)
Begin_JSON.xlsx (10.2 KB)

1 Like