Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
When storing a table from Qlik Sense as a txt file, there is always a blank line at the end of the txt file. How to avoid that blank line?
Please let me know is there a direct solution or can it be achieved by a workaround?
Thanks
Hi @qv_testing , @marcus_sommer ,
I achieved the desired output by executing the following power shell script from qlik script:
Execute powershell [System.IO.File]::WriteAllText('test.txt', ((Get-Content 'test.txt' -Raw) -replace '\r?\n$'))
I think you have null records in data.
use this condition in script:
Where LEN(ID_Field)>0
Hi @qv_testing , there are no null records.
For example, try this
Test:
Load * Inline [
ID, DIM
1, A
2, B
3, C
4, D
5, E
6, F
7, G
8, H
9, I
10, J
11, K
12, L
13, M
14, N
15, O
];
Store Test into [filepath/test.txt](txt);
Open the generated test.txt file and see. There will be a blank line at the end of the txt file. How to avoid that?
I feel that is not exactly the blank record - if you load back to qlik nothing is blank.
Hi @qv_testing , yeah that is true if you load back. But the output txt file should not have that blank line. The requirement from the user is to avoid that blank line in the txt file.
Is there a way to avoid that blank line at the end of the file?
There is not really an empty line else the last char of the last record is a line-break. Many viewer-tools and import-logic make from it a new empty line.
I doubt that there are any possibilities to adjust this behaviour during the export because it's a "feature" of used library.
In many cases it's not too hard to adjust the target-system to skip this empty line. A workaround to it might be to add a single EOF to the last field-value of the last field before the store is performed, maybe something like:
concatenate(MyTable) load chr(4) as LastField autogenerate 1;
The last char will be probably remain the line-break but most import-logic are stopping the read-process if there is any EOF included.
If nothing of the above is working or practically you will need an external batch to adjust the file.
Thanks @marcus_sommer , I will try that.
Hi @qv_testing , @marcus_sommer ,
I achieved the desired output by executing the following power shell script from qlik script:
Execute powershell [System.IO.File]::WriteAllText('test.txt', ((Get-Content 'test.txt' -Raw) -replace '\r?\n$'))