A super quick article on something that almost deserves its own article: using new lines in ZohoDeluge.
Why?
My use-case here is that I was generating a comma separated values (CSV) file given some lists and strings and although the same code worked great on one Zoho CRM, another client's ZohoCRM was not accepting "\n" as a new line character and instead would render/display it as "\n"...
What I have What I want
How?
So in this article I just want to list some various methods of inserting a new line character.
Works on most systems:
l_CsvFileRows = List(); l_CsvFileRows.add("Me,Myself,I"); l_CsvFileRows.add("a,b,c"); // v_CSVFilename = "Test.csv"; f_CSVFile = l_CsvFileRows.toString("\n").toFile(v_CSVFilename); // // sometimes works but sometimes yields: // Me,Myself,I\na,b,c
- l_CsvFileRows = List();
- l_CsvFileRows.add("Me,Myself,I");
- l_CsvFileRows.add("a,b,c");
- //
- v_CSVFilename = "Test.csv";
- f_CSVFile = l_CsvFileRows.toString("\n").toFile(v_CSVFilename);
- //
- // sometimes works but sometimes yields:
- // Me,Myself,I\na,b,c
Works on systems where the above doesn't work:
l_CsvFileRows = List(); l_CsvFileRows.add("Me,Myself,I"); l_CsvFileRows.add("a,b,c"); // v_CSVFilename = "Test.csv"; f_CSVFile = l_CsvFileRows.toString(zoho.encryption.urlDecode("%0A")).toFile(v_CSVFilename); // // yields: // Me,Myself,I // a,b,c
- l_CsvFileRows = List();
- l_CsvFileRows.add("Me,Myself,I");
- l_CsvFileRows.add("a,b,c");
- //
- v_CSVFilename = "Test.csv";
- f_CSVFile = l_CsvFileRows.toString(zoho.encryption.urlDecode("%0A")).toFile(v_CSVFilename);
- //
- // yields:
- // Me,Myself,I
- // a,b,c
Additional
- Adding to a screen output: eg. a button response or response of info: try holding down the ALT key and pressing 255, then releasing the ALT key and save the change to your code. This will not display a character but is a new line...
- Used in certain cases
- Thought I needed to add the following but this makes absolutely no difference: