Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
sreenivaskollur
Contributor II
Contributor II

Varable Value not loaded correctly into INLINE table

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!

1 Solution

Accepted Solutions
sunny_talwar

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 |);

View solution in original post

11 Replies
sunny_talwar

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 |);

vishsaggi
Champion III
Champion III

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

];

sunny_talwar

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)"

];

vishsaggi
Champion III
Champion III

Hi Sunny, I used your inline but it still truncates data after comma? It is not giving me full text?

sunny_talwar

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 |);

vishsaggi
Champion III
Champion III

Nope i just copy pasted the whole script still it shows truncated script. Is it working at your end?

sunny_talwar

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 |);

vishsaggi
Champion III
Champion III

Cool. This worked. Did not know about this double quotes in INLINE. Thanks for trying this.

sunny_talwar

Absolutely