Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

QV Script Structure

I'm new to QlikView and so far i've been able to pick up everything...except for the script data load.  I inhereted the reports i'm working with right now and am having problems understanding why some datasets are using the "Directory" options while others are just using an alias name.   Can someone explain this?  I'm really want to make the reports load the data in the most least-taxing way possible and I can't do this without understanding what's going on here.

For Example:

***************************************

Customers:   <---What is this doing?!

Load

  CustomerName,

CustomerID

    ;

SQL SELECT  *

FROM dbo.Customers;

***************************************

Directory;  <---What is this doing?!

Load

     Terms,

     TermID;

SQL SELECT *

FROM dbo.PaymentTerms;

***************************************

1 Solution

Accepted Solutions
matt_crowther
Specialist
Specialist

Your 'Customers:' statement is labelling the subsequent table 'Customers' so once loaded if you press Ctrl+t and view the Table view you'll see you have a table called 'Customers'. In most cases it's simply there for best practice to easily identify which table is which eg when selecting new fields from the Sheet Properties dialog.

When correct naming of tables becomes crucial is when using the 'Qualify' statement, this prefixs all your field names with the name af the table to break any unwanted associations eg fields A, B and C become Customers.A, Customers.B and Customers.C.

As far as I understand 'Directory;' only appears when you're using Relatice Paths in the load script (bottom of Script Editor) - personally I always delete it as it's confusing and pointless (I've never had a problem caused by deleting it), search the help file for 'Directory' and it will give you the following explanation (that still seems pointless):

/////////////////////////////////////////////////////////////////

load statement can be preceded by a directory statement, defining what directory to look for the files in.

directory path

where:

path is a text that can be interpreted as the path to the file, either absolute, or relative to the .qvw file.

Example:

Directory c:\userfiles\data;

The directory defined through this statement is used by subsequent load statements, until a new directory statement is made.

A directory statement is generated automatically if Relative Paths is enabled in the Edit Script dialog.

////////////////////////////////////////

Hope that helps,

Matt - Visual Analytics Ltd

View solution in original post

1 Reply
matt_crowther
Specialist
Specialist

Your 'Customers:' statement is labelling the subsequent table 'Customers' so once loaded if you press Ctrl+t and view the Table view you'll see you have a table called 'Customers'. In most cases it's simply there for best practice to easily identify which table is which eg when selecting new fields from the Sheet Properties dialog.

When correct naming of tables becomes crucial is when using the 'Qualify' statement, this prefixs all your field names with the name af the table to break any unwanted associations eg fields A, B and C become Customers.A, Customers.B and Customers.C.

As far as I understand 'Directory;' only appears when you're using Relatice Paths in the load script (bottom of Script Editor) - personally I always delete it as it's confusing and pointless (I've never had a problem caused by deleting it), search the help file for 'Directory' and it will give you the following explanation (that still seems pointless):

/////////////////////////////////////////////////////////////////

load statement can be preceded by a directory statement, defining what directory to look for the files in.

directory path

where:

path is a text that can be interpreted as the path to the file, either absolute, or relative to the .qvw file.

Example:

Directory c:\userfiles\data;

The directory defined through this statement is used by subsequent load statements, until a new directory statement is made.

A directory statement is generated automatically if Relative Paths is enabled in the Edit Script dialog.

////////////////////////////////////////

Hope that helps,

Matt - Visual Analytics Ltd