Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Asuod_
Contributor III
Contributor III

Button to Execute Partial Reload

Hello, Im new to qlik sense and using the button widget. I would like to have a button that execute a part of the script in the Data Load Editor to update a QVD. 

I am trying to execute the script below:

"NewMilestones_QVD:

Load

Rank,

Ranking,

if(Rank = Priority, Priority, Rank) as Priority,

Milestone,

FROM [lib://RPA HuNTx Analytics QVD Store/Milestone_Test.qvd]

(qvd);

Store NewMilestones_QVD into [lib://RPA HuNTx Analytics QVD Store/Milestone_Test.qvd]

(qvd);"

 

In the button I used: "$(must_include=$(vPartialReloadScript))"

In the Data Load Editor I used: 

"SET vPartialReloadScript = '

NewMilestones_QVD:

Load

Rank,

Ranking,

if(Rank = Priority, Priority, Rank) as Priority,

Milestone,

FROM [lib://RPA HuNTx Analytics QVD Store/Milestone_Test.qvd]

(qvd);

Store NewMilestones_QVD into [lib://RPA HuNTx Analytics QVD Store/Milestone_Test.qvd]

(qvd);

';"

Not sure if this is the best way to go about this, any assistance is appreciated. Thank you. 

Labels (1)
2 Replies
RafaelBarrios
Partner - Specialist
Partner - Specialist

hi @Asuod_ 

your button onle need this

RafaelBarrios_2-1688327649102.png

The important thing is that in your script you identify those parts that you want to be executed only when a partial reload is executed

https://help.qlik.com/en-US/sense/May2023/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptPrefixes/...

 

the following script will execute only in standar reload

NewMilestones_QVD:
Load
Rank,
Ranking,
if(Rank = Priority, Priority, Rank) as Priority,
Milestone,
FROM [lib://RPA HuNTx Analytics QVD Store/Milestone_Test.qvd](qvd);
Store NewMilestones_QVD into [lib://RPA HuNTx Analytics QVD Store/Milestone_Test.qvd](qvd);

 

this one will execute on standar and partial reload

NewMilestones_QVD:
add Load
Rank,
Ranking,
if(Rank = Priority, Priority, Rank) as Priority,
Milestone,
FROM [lib://RPA HuNTx Analytics QVD Store/Milestone_Test.qvd](qvd);
Store NewMilestones_QVD into [lib://RPA HuNTx Analytics QVD Store/Milestone_Test.qvd](qvd);

 

and this only in partial reload

NewMilestones_QVD:
add only Load
Rank,
Ranking,
if(Rank = Priority, Priority, Rank) as Priority,
Milestone,
FROM [lib://RPA HuNTx Analytics QVD Store/Milestone_Test.qvd](qvd);

//without this IF, the STORE will return error on partial reloads
IF IsPartialReload() THEN
Store NewMilestones_QVD into [lib://RPA HuNTx Analytics QVD Store/Milestone_Test.qvd](qvd);
ENDIF;

 

also, remember you can set Partial reload in QMC

RafaelBarrios_1-1688327574922.png

 

Hope this helps,

help users find answers! Don't forget to mark a solution that worked for you & to smash the like button!

 

Asuod_
Contributor III
Contributor III
Author

hi @RafaelBarrios, thank you for the reply. The script you provided worked i used the partial reload but it caused duplicates. 

So right now i have a vizlib writeback table which i can change values and update the QVD but im looking to have another button to run a partial reload to make changes to the QVD as well. I have attached picture of the dashboard. The "Priority" column you are able to edit but with the writeback it allows you to select duplicate values, what im trying to do is when they hit the partial reload at the top then it takes the "Ranking" value and replaces the "Priority" value so there are no duplicates.

Asuod__0-1688663228138.png

 

Writeback Script:

let vFileName = 'Milestone_Test.qvd';

let vFileExists = FileTime(vFileName);

LET vScriptErrorDetails = ScriptErrorDetails;

IF vScriptErrorDetails <> Null() THEN

EXIT SCRIPT;

END IF;

IF vFileExists THEN

VizlibWritebackTable:

REPLACE LOAD

*

From "lib://Milestone_Test.qvd" (qvd, utf8);

ELSE

VizlibWritebackTable:

REPLACE LOAD

*

Inline [

'Ranking','Rank','Priority','Milestone','Milestone_count'

];

 

LET vScriptErrorDetails = ScriptErrorDetails;

IF vScriptErrorDetails <> Null() THEN

EXIT SCRIPT;

END IF;

END IF

Partital Reload:

NewMilestones_QVD:

add only Load distinct

      Milestone,

    Rank,

    Ranking,

    if(Ranking = Priority, Priority, Ranking) as Priority

FROM [lib://Milestone_Test.qvd](qvd);

//without this IF, the STORE will return error on partial reloads

IF IsPartialReload() THEN

    Store NewMilestones_QVD into [lib://Milestone_Test.qvd](qvd);

ENDIF;