Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
cwitman1
Contributor III
Contributor III

Insert, Update, (no Delete)

https://help.qlik.com/en-US/sense/3.0/Subsystems/Hub/Content/LoadData/use-QVD-files-incremental-load...

I am looking to do insert and update within ticket # data.

So my data is a weekly csv that gets automatically sent to a directory.

The unique key is ticket # the other fields that change are closed date and comment section.

So i want the data load to update these fields if necessary when there is a new file dropped each week.

instead of creating a duplicate when these fields have data.

Is this possible when using CSV?

(I know i can just archive or delete old CSVs, but I would like this to work without having to do that)

Thanks

1 Solution

Accepted Solutions
6 Replies
tomasz_tru
Specialist
Specialist

cwitman1
Contributor III
Contributor III
Author

Hi Tomasz,

This makes sense, the only question i have is within the incremental load.

"Where modified_date > $(Last_Updated_Date);"

Is the $(Last_Updated_Date) suppose to be a qlik function? what exactly goes here?

tomasz_tru
Specialist
Specialist

$(Last_Updated_date) gives you a value of variable 'Last_Updated_date' (dolar sign evaluates it).

This variable has been set by LET =(...) statement.

cwitman1
Contributor III
Contributor III
Author

Oh okay, got that.

Now when i do my where clause " WHERE Closed > $(vClose);"

I receive the error = "

The following error occurred:

Field '>' not found"

tomasz_tru
Specialist
Specialist

Can you show us whole part of the script?

cwitman1
Contributor III
Contributor III
Author

//Load data from QVD

ChangeTEST:

LOAD

    Number,

    State,

    "Created by",

    "Closed by",

    Created,

    "Configuration Item",

    "Emergency Change",

    Risk,

    Stage,

    "Type",

    Category,

    Environment,

    Workflow,

    Closed,

    "Planned start date",

    "Planned end date",

    "Short Description",

    "Description of Change",

    Department

FROM [lib://SEC_FileShare/QVD\Users\Chris_Witman\Change_TEST.qvd]

(qvd);

//Find Last Closed Date

Last_Close_Date:

load max(Closed) as MaxClose

resident ChangeTEST;

//Store Last Close Date to a variable

Let  vClose = peek('MaxClose',0,'Last_Close_Date');

//Delete ChangeTest Table

Drop Table ChangeTEST;

Incremental_Change:

LOAD

    Number,

    State,

    "Created by",

    "Closed by",

    Created,

    "Configuration Item",

    "Emergency Change",

    Risk,

    Stage,

    "Type",

    Category,

    Environment,

    Workflow,

    Closed,

    "Planned start date",

    "Planned end date",

    "Short Description",

    "Description of Change",

    Department

FROM [lib://SEC_FileShare/Budget\Change_Control\Test\Change_Requests_*.csv]

(txt, codepage is 1252, embedded labels, delimiter is ',', msq)

WHERE Closed > $(vClose);