Q-Expert · Real cases · Q-Expert DistributorsLeer en español
Episode1

Three files, one table

Step-by-step manual

01The business question

Q-Expert Distributors receives its sales as one file per month: Sales_2025_01.csv, Sales_2025_02.csv and Sales_2025_03.csv. The team wants all of them in one table, and next month's file should load without anyone touching the script.

02Before you start

03Step by step

  1. 1

    Create the project

    Click New Project in the top bar. Name it Q-Expert Distributors and click Create Project. Every model starts on a clean canvas.

    Create the project
    Figure 1.1 — Create the project
  2. 2

    Say where the files live

    Open Project Settings → Source Paths. Add a mapping with the variable name vPathRaw and the folder QXDistributors, so the row reads vPathRaw = lib://QXDistributors/. In the same tab, set vTxfPath to lib://QXDistributors/Transform/: the work QVDs and the script files Q-Expert splits out live there, under the same connection.

    Say where the files live
    Figure 1.2 — Say where the files live
  3. 3

    Set the project's number formats

    These files use a dot for decimals and a comma for thousands. Click $(x) in the top bar and, on the Predefined tab, set:

    • ThousandSep ,
    • DecimalSep .
    • MoneyThousandSep ,
    • MoneyDecimalSep .
    • MoneyFormat $ #,##0.00;-$ #,##0.00
    Set the project's number formats
    Figure 1.3 — Set the project's number formats
  4. 4

    Add the project variables

    Switch to the Project tab and add, each with the + button:

    • vEnvironment = PROD
    • vBaseCurrency = COP (episode 4 uses it)

    Then click Save.

    Add the project variables
    Figure 1.4 — Add the project variables
  5. 5

    Add the three sales files

    In the Library, click Add Files and pick the three Sales_2025_0N.csv files. Q-Expert sees the same columns in all of them and groups them under one pattern, Sales_*.csv.

    Add the three sales files
    Figure 1.5 — Add the three sales files
  6. 6

    Drag the group onto the canvas

    Drag the Sales_*.csv group header onto the canvas. One RAW node reads every month: the three files of today and the ones still to come.

    Drag the group onto the canvas
    Figure 1.6 — Drag the group onto the canvas
  7. 7

    Name it as a work table

    Select the node. On the Config tab, type tmp_SalesRaw as the table name and press Tab.

    Name it as a work table
    Figure 1.7 — Name it as a work table
  8. 8

    Say why, in a comment

    On the Info tab, write in Comments: Sales arrive as one file per month; the wildcard reads every month, including next month's file. It goes into the script right above the LOAD.

    Say why, in a comment
    Figure 1.8 — Say why, in a comment
  9. 9

    Generate the script

    Click Generate Syntax and open the Flow_1 tab. One LOAD with an asterisk in the path, read through the variable: FROM [$(vPathRaw)Sales_*.csv]. Next month's file just works.

    Generate the script
    Figure 1.9 — Generate the script
  10. 10

    The same idea with QVD files

    Add the three files from data/Raw/. They are QVDs, so the Library makes a second group, Sales_*.qvd, next to Sales_*.csv. Dragged onto the canvas, it reads them with (qvd). The course continues with the CSV files, so leave this group in the Library.

    The same idea with QVD files
    Figure 1.10 — The same idea with QVD files

04Check your result

_Main

Paste into Qlik

This is the only script you paste into Qlik Sense: open the app's Data load editor, replace its content with this and reload. Each $(MUST_INCLUDE=…) line reads one of the files below in its place, so the rest of the model never goes into the editor.

Show script · 42 lines
/*----------------------------------------------------------------------------------------
	Description [MAIN]:
		
	-------------------------------------------------------------------------------------
	Author:	The Q-Fábrica team - 
	Date:	[2026-11-02]
	-------------------------------------------------------------------------------------
	Changes
	-------------------------------------------------------------------------------------
	Author		Date		Detail
	-------------------------------------------------------------------------------------

	-------------------------------------------------------------------------------------
	Copyright © Q-Expert Distributors.
	Q-Expert Qlik Developer Framework. www.qfabrica.com
----------------------------------------------------------------------------------------*/

SET ThousandSep=',';
SET DecimalSep='.';
SET MoneyThousandSep=',';
SET MoneyDecimalSep='.';
SET MoneyFormat='$ #,##0.00;-$ #,##0.00';
SET TimeFormat='hh:mm:ss';
SET DateFormat='YYYY-MM-DD';
SET TimestampFormat='YYYY-MM-DD hh:mm:ss';
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
SET LongDayNames='Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;Sunday';
SET FirstWeekDay=0;
SET BrokenWeeks=1;
SET ReferenceDay=4;
SET FirstMonthOfYear=1;

LET vExecutionDate = Timestamp(Now(), 'YYYY-MM-DD hh:mm:ss');

SET vTxfPath  = 'lib://QXDistributors/Transform/';
SET vPathRaw = 'lib://QXDistributors/';
SET vEnvironment = 'PROD';   // PROD, QA or DEV
SET vBaseCurrency = 'COP';   // Currency every amount is converted to

$(MUST_INCLUDE=$(vTxfPath)_QVS/Flow_1.qvs);

Flow_1.qvs

File · read by MUST_INCLUDE

Not pasted: saved as a file. On the Flow_1 tab of Generate Syntax, Export downloads Flow_1.qvs (Deploy writes every tab into a folder at once). Put it in lib://QXDistributors/Transform/_QVS/Flow_1.qvs, the Transform/_QVS folder inside your QXDistributors folder. If the file is not there, the reload stops with an error: that is what MUST_INCLUDE is for.

Show script · 33 lines
/*----------------------------------------------------------------------------------------
	Description [Flow_1]:
		
	-------------------------------------------------------------------------------------
	Author:	The Q-Fábrica team - 
	Date:	[2026-11-02]
	-------------------------------------------------------------------------------------
	Changes
	-------------------------------------------------------------------------------------
	Author		Date		Detail
	-------------------------------------------------------------------------------------

	-------------------------------------------------------------------------------------
	Copyright © Q-Expert Distributors.
	Q-Expert Qlik Developer Framework. www.qfabrica.com
----------------------------------------------------------------------------------------*/

// -------------------------------------------------------------------------------------------------
// Sales arrive as one file per month; the wildcard reads every month, including next month's file.
[tmp_SalesRaw]:
    LOAD
        SaleID,
        SaleDate,
        CustomerID,
        ProductID,
        SalespersonID,
        BranchID,
        Quantity,
        UnitPrice,
        DiscountPct,
        Currency,
        Channel
    FROM [$(vPathRaw)Sales_*.csv] (txt, delimiter is ',', embedded labels);

05Why this way

06What comes next

Episode 2: the same files, but we need to know which month each row came from.

Before you model

Q-Explorator is the Q-Fábrica team's desktop tool to explore QVD, CSV, Excel and Parquet files and to convert CSV, TXT and Excel files into QVD. Open the files of each episode in it to see their content and quality first.

About Q-Explorator