Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
we have a application in qlikview where we read data from logs generated from several other applications.
while we were on qlikview 11.2 the logs were read properly with encoding type as below.
load @1:10,@12:20,@37:n
from a\b\c\abc.qvw.log (fix,unicode)
however since after we are testing on qlikview12.40 the data is not read with same encoding configurations.
we tried with encoding (fix,utf8) and (fix,codepage is 1252) but in both cases we have numbers fetched incorrectly in the fields.
we also tried generating the log files in utf-8 and then setting encoding from section to (fix,utf8) but no luck.
can someone help on how to load and read the document log files in qlikview 12.40?
On my machine, I'm successful reading 12.40 logs as utf8. However I do find a mix of encoding between versions and I think sometimes between customers. In the Script Log Analyzer, I use this bit of conditional script to read one row from the log to determine the encoding for that file.
// Determine the character encoding of the logfile by reading the first few bytes.
// QV11.2 is writing logs in unicode.
FOR EACH vEncoding IN 'utf8', 'unicode', 'codepage is 1252';
TempCode:
FIRST 1 // Log first row
LOAD IsNum(left(@1:n,1)) as X // Test first char. Set to true if it's a number.
FROM
[$(_logpath)]
(fix, $(vEncoding))
WHERE RecNo()>1 // Skip rec 1, which causes problems if it has a BOM (Byte Order Marker)
;
EXIT FOR WHEN peek('X'); // If a number, assume we have the right encoding.
NEXT vEncoding;
At the end of the loop vEncoding contains the right encoding which can be used in a subsequent statement to read the entire file.
-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com
Hi Rob,
i tried separately with each type.
(fix,unicode) nothing returned
(fix,codepage is 1252)
(fix,utf8) values returned but were incorrect , i mean the date which i tried to pick @1:10 from log should ideally pick only date i.e execution date but 3 values were picked with broken dates.
1 value : -09-2019
2 value : -2019
3 value : 24-09-2019
other than the the other sub strings which i picked from log used to be correct in 11.2 version but were broken in 12.40
eg qlikview 11.2 had field (@27:n) picked correctly but are picked incorrectly in 12.40.
I just ran and checked the above script.
only replaced my path in above scipt.
end result is x field with value 0
when tried to debug, it returned below result:
Tempcode << abc.qvw 1 line fetched
Tempcode << abc.qvw 2 lines fetched
Tempcode << abc.qvw 3 lines fetched
and the end result was field X with value 0 on front end.
Question would be what is the value of vEncoding at the end of your loop?
The 3rd date looks correct to me, but the first 2 look like an offset is wrong. Can you post (attach) one of the log files?
-Rob
Check out the following link to the Governance Dashboard area, and and pull the latest QVW for that and have a look at the script in there, that should help you confirm how Tyler has done things, and I would expect if you copy that, it should work for you as well.
Otherwise you can follow-up with Rob, sorry I do not have anything better at the moment. There was a timestamp formatting change between 11.20 and 12.xx tracks, but I cannot see that that should be a major issue here, that is where I am hoping the GDB QVW script may be of some help to you. There may be logic in there to handle 11.20 v 12.xx too, just FYI.
Regards,
Brett
Note also that the date format differs in V11 and V12. In V11, log dates are in the TimeStamp format set in the script, which is usually localized. In V12, the format is always ISO 'YYYY-MM-DD hh:mm:ss'.
-Rob
'