Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm new to QlikView development, could someone help me to fix this issue?
I'm using the below script to capture the error details if the hive connection is failed.
Sample script,
ODBC CONNECT TO [HIVE-DB];
LET vCapturedError=ScriptErrorDetails;
TRACE $(vCapturedError);
LOAD * INLINE [
DB, Connection_Status, Error
HIVE-DB, Failed, '$(vCapturedError)'
];
If I trace a variable vCapturedError, it shows the output as below, which the actual error:
SQL##f - SqlState: IM002, ErrorCode: 0, ErrorMsg: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
But when I read the same variable value in LOAD * INLINE table, it is just loading a piece of it as:
'SQL##f - SqlState: IM002
Please help to fix it?
Your help is much appreciated, thank you!
I guess the square brackets were the next set of issue... but this worked
LET vCapturedError='SQL##f - SqlState: IM002, ErrorCode: 0, ErrorMsg: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified';
TRACE $(vCapturedError);
LOAD * INLINE "
DB | Connection_Status | Error
HIVE-DB | Failed | '$(vCapturedError)'
" (delimiter is |);
So this should work for OP
ODBC CONNECT TO [HIVE-DB];
LET vCapturedError=ScriptErrorDetails;
TRACE $(vCapturedError);
LOAD * INLINE "
DB | Connection_Status | Error
HIVE-DB | Failed | '$(vCapturedError)'
" (delimiter is |);
Change the delimiter from Comma to a pipe. Because delimiter is comma, the data up until comma is read in that field.....
ODBC CONNECT TO [HIVE-DB];
LET vCapturedError=ScriptErrorDetails;
TRACE $(vCapturedError);
LOAD * INLINE [
DB | Connection_Status | Error
HIVE-DB | Failed | '$(vCapturedError)'
] (delimiter is |);
Try this if this may work for you?
ODBC CONNECT TO [HIVE-DB];
LET vCapturedError = ScriptErrorDetails;
TRACE $(vCapturedError);
LOAD *, '$(vCapturedError)' as Error INLINE [
DB, Connection_Status
HIVE-DB, Failed
];
Or you can also use double quotes around your variable
ODBC CONNECT TO [HIVE-DB];
LET vCapturedError=ScriptErrorDetails;
TRACE $(vCapturedError);
LOAD * INLINE [
DB, Connection_Status, Error
HIVE-DB, Failed, "$(vCapturedError)"
];
Hi Sunny, I used your inline but it still truncates data after comma? It is not giving me full text?
This one too?
ODBC CONNECT TO [HIVE-DB];
LET vCapturedError=ScriptErrorDetails;
TRACE $(vCapturedError);
LOAD * INLINE [
DB | Connection_Status | Error
HIVE-DB | Failed | '$(vCapturedError)'
] (delimiter is |);
Nope i just copy pasted the whole script still it shows truncated script. Is it working at your end?
I guess the square brackets were the next set of issue... but this worked
LET vCapturedError='SQL##f - SqlState: IM002, ErrorCode: 0, ErrorMsg: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified';
TRACE $(vCapturedError);
LOAD * INLINE "
DB | Connection_Status | Error
HIVE-DB | Failed | '$(vCapturedError)'
" (delimiter is |);
So this should work for OP
ODBC CONNECT TO [HIVE-DB];
LET vCapturedError=ScriptErrorDetails;
TRACE $(vCapturedError);
LOAD * INLINE "
DB | Connection_Status | Error
HIVE-DB | Failed | '$(vCapturedError)'
" (delimiter is |);
Cool. This worked. Did not know about this double quotes in INLINE. Thanks for trying this.
Absolutely