Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
I have a qlikview script where I'm reading from QVS file. I'm getting spaces in script log. I want to remove the spaces which is appearing in script. Below is the screen shot.
Please help on the above
Hi
You could also try the following, note there is a funny non-space char at the beginning of the first line of your test log that is the reason for the PurgeChar()
RAWLOG:
NoConcatenate
LOAD PurgeChar(Trim([@1:n]),chr(65279)) as Log_Line
FROM [Test log.log]
(fix, utf8, no labels);
LOG:
NoConcatenate
LOAD
Left(Log_Line,10) as Load_Date,
Mid(Log_Line,12,8) as Load_Time,
Left(Log_Line,19) as Date_Time,
Mid(Log_Line,20,5) as PID,
Trim(Mid(Log_Line,25)) as Description
Resident RAWLOG;
DROP Table RAWLOG;
Regards
Adrian
@rwunderlich Need your suggestion on this please.
Those spaces are inserted by the logger to indicate you are in nested code.
If you want to remove those leading spaces when loading the log, use the Trim() function.
-Rob
Thanks for the reply.
I use trim function. Still getting the same.
Data after loading:
hi,
can you attach your file to do test,
K. Srinivasan.
I'm unable to upload txt file. attched in zip format. please un zip and load
hi,
before execute your LOAD, you can execute below Statement,
TRIM:
LOAD
@1,
@2,
@3,
@4
FROM [lib://TEST_CASE/Test log.log]
(txt, utf8, no labels, delimiter is spaces, msq);
Store TRIM into [lib://TEST_CASE/Viviksingh.txt] (txt);
then use Viviksingh.txt as source file of your Script,
i attached output in text format, it has no indented space in front of log lines,
K. Srinivasan.
Thanks for the reply. We should not change the input file as these are the logs generated by qlikview.
Please let me know if there is any other way.
Hi,
Just you copy and past below Script as Given, just change your file path,
TEMP:
load
*,
Mid(YES_01,1,10) AS LOAD_DATA,
Mid(YES_01,11,8) AS LOAD_TIME,
Mid(YES_01,1,18) AS Date_Time,
Mid(YES_01,19,24) AS PID,
Mid(YES_01,25,100) AS Description,
LEFT(YES_01,10) as DTS;
LOAD
*,
DATE(LEFT(YES_01,10),'DD-MM-YYYY') as CHE;
LOAD
*,
Replace(YES,'','') as YES_01;
LOAD
*,
Replace(TEST,' ','') as YES;
LOAD [@1:n] as TEST
FROM
[C:\Users\Ksrinivasan\Desktop\Cali\Test log.QVS.log]
(fix, utf8, no labels);
Result Below:
K. Srinivasan.
Hi
You could also try the following, note there is a funny non-space char at the beginning of the first line of your test log that is the reason for the PurgeChar()
RAWLOG:
NoConcatenate
LOAD PurgeChar(Trim([@1:n]),chr(65279)) as Log_Line
FROM [Test log.log]
(fix, utf8, no labels);
LOG:
NoConcatenate
LOAD
Left(Log_Line,10) as Load_Date,
Mid(Log_Line,12,8) as Load_Time,
Left(Log_Line,19) as Date_Time,
Mid(Log_Line,20,5) as PID,
Trim(Mid(Log_Line,25)) as Description
Resident RAWLOG;
DROP Table RAWLOG;
Regards
Adrian