Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

cwitman1
New 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
tomasz_tru
Valued Contributor

Re: Insert, Update, (no Delete)

6 Replies
tomasz_tru
Valued Contributor

Re: Insert, Update, (no Delete)

cwitman1
New Contributor III

Re: Insert, Update, (no Delete)

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
Valued Contributor

Re: Insert, Update, (no Delete)

$(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
New Contributor III

Re: Insert, Update, (no Delete)

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
Valued Contributor

Re: Insert, Update, (no Delete)

Can you show us whole part of the script?

cwitman1
New Contributor III

Re: Insert, Update, (no Delete)

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

Community Browser