Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

hilarygayhart
New Contributor III

Execute SQL Function in Qlikview Script

Hi Qlikview Community!

Has anyone successfuly used a sql function in qlikview?

I have seen a ton of started conversations, but it seems we all get stuck with a permissions error.

(I can execute the function in sql with the same permissions, so I know that is not the true error.)

Hope we can figure this out together!

Thanks!

Tags (4)
13 Replies
Not applicable

Re: Execute SQL Function in Qlikview Script

Hi,

I usually just pull all the fields I need and then in the preload i use qlikview functions.

You can give that a whirl.

Thanks

AJ

MVP
MVP

Re: Execute SQL Function in Qlikview Script

What kind of SQL function? Can you post an example..

MVP
MVP

Re: Execute SQL Function in Qlikview Script

Is this a table based function or a scalar based function?  Have you tried wrapping the output from the function in a view?

I would try going to the Settings tab on the load script and tick the Open Databases In Read Write Mode tick box and add the text (mode is write) after the connection string (between the ] and the ; .

Hope one of these things helps.

Steve

Re: Execute SQL Function in Qlikview Script

You can use QlikView Function by preceding load.

OLEDB CONNECT32 TO .....:

LOAD

     DepartmentID,

    Name,

    GroupName,

    Date,

     Month(Date) as Month,

     Year(Date) as Year;

SQL SELECT

    DepartmentID,

    Name,

    GroupName,

    Date

FROM TableName;

MVP
MVP

Re: Execute SQL Function in Qlikview Script

Uh.., dangerous write mode.. Usually this shouldn't be needed to execute a function.

MVP
MVP

Re: Execute SQL Function in Qlikview Script

Personally I tend to avoid using write mode - I can only think of one case where I have had to (the only access I was given to the database was to a Stored Procedure that did some inserts before returning any data) but it is worth trying it to see if the function works.

hilarygayhart
New Contributor III

Re: Execute SQL Function in Qlikview Script

Hi Ralf,

I am trying to work with a user defined function.  Here is generic example, hope it paints the picture:

LOAD

Field1,

Field2,

Field3;

SQL

SELECT

Field1,

Field2,

Field3

From Database

Where Database.udf_Table (Field1) = 0

hilarygayhart
New Contributor III

Re: Execute SQL Function in Qlikview Script

I haven't tried wrapping - not sure what that entails.

Write mode is not an option for me, as the user base cannot have those rights.

MVP
MVP

Re: Execute SQL Function in Qlikview Script

Maybe you're using a different database user in QlikView connection?

Community Browser