Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load data from a macro or button

Im looking for a way fo trigger a load of data from a user interaction. It will be a different data load from the initial load.

Scenario is this: Data load initially is Sales data, this data is then passed out to another tool that carries out some further analysis and then returns a result.

I wish to then load this result.

The button, triggers the external app to carry out its analysis .. then loads the new data set back in to populate a graph .. etc ..

Any support gratefully received.

1 Solution

Accepted Solutions
vgutkovsky
Master II
Master II

It would look something like this:

Integration:

LOAD * ;

SQL SELECT *

FROM view_rows?eid=38&max_rows=30000;

store Integration into c:\Data\Insurance\Transactions_qv.txt (txt);

IF ispartialreload() THEN

SET ErrorMode = 0;

DROP TABLE Validate;

SET ErrorMode = 1;

Validate:

ADD LOAD "Entity ID"as [Entity ID],

    Entity,

         if(Attribute = '','Context','Content') as [Business Rule Type],

    Attribute,

    "Rule Name" as [Rule Name],

    Description,

    Threshold,

    Result,

    "Passing Fraction" as [Pasing Fraction],

    "Failing Rows" as [Failing Rows],

    "Passing Rows" as [Passing Rows],

    "Passing Aggregate" as [Passing Aggregate],

    "Failing Aggregate" as [Failing Aggregate],

    date("Date Created",'DD/MM/YYYY') as [Date Created];

SQL SELECT "Entity ID",

    Entity,

    Attribute,

    "Rule Name",

    Description,

    Threshold,

    Result,

    "Passing Fraction",

    "Failing Rows",

    "Passing Rows",

    "Passing Aggregate",

    "Failing Aggregate",

    "Date Created",

FROM show_all_br?pid=39;

END IF

The enclosing IF statement is necessary to make sure that the Validate table is only read during a partial reload and not during a regular reload. To execute a Partial Reload, you can create a new button, add an External Action of Reload, and check the "Partial" checkbox. Again, keep in mind that this will only work in QV Desktop. To execute a partial reload when the application is open in QVS, you will need to use EDX triggers.

Alternatively, you may find it easier to create a separate "validation" application that will use this file and avoid the partial reload confusion altogether.

Regards,

Vlad

View solution in original post

4 Replies
vgutkovsky
Master II
Master II

You can accomplish this with a Partial Reload. You can read more about the syntax ("add" and "replace") in the help file. I believe there's also a function "ispartialreload" that you can use to exclude your partial reload logic from the main data load. Then you can trigger this with a button if you want. If users are opening the application in server, you would have to create a partial reload task, enable EDX, and then trigger the EDX with the button. If they're opening it in QV Desktop, it's easier since reloads are permitted.

Regards,

Vlad

Not applicable
Author

Vlad, thanks for the reply, being new Im not sure of the scripting context ..

could you let me see an example?

Currently initial load does the following - excuse the syntax on the SQL - we are working on a unique application adapter

Integration:

LOAD * ;

SQL SELECT *

FROM view_rows?eid=38&max_rows=30000;

store Integration into c:\Data\Insurance\Transactions_qv.txt (txt);

The above file is then consumed by the external application...

how do I keep the script below distinct from the initial load.. and make it only run on the button?

Validate:

LOAD "Entity ID"as [Entity ID],

    Entity,

         if(Attribute = '','Context','Content') as [Business Rule Type],

    Attribute,

    "Rule Name" as [Rule Name],

    Description,

    Threshold,

    Result,

    "Passing Fraction" as [Pasing Fraction],

    "Failing Rows" as [Failing Rows],

    "Passing Rows" as [Passing Rows],

    "Passing Aggregate" as [Passing Aggregate],

    "Failing Aggregate" as [Failing Aggregate],

    date("Date Created",'DD/MM/YYYY') as [Date Created];

SQL SELECT "Entity ID",

    Entity,

    Attribute,

    "Rule Name",

    Description,

    Threshold,

    Result,

    "Passing Fraction",

    "Failing Rows",

    "Passing Rows",

    "Passing Aggregate",

    "Failing Aggregate",

    "Date Created",

FROM show_all_br?pid=39;

vgutkovsky
Master II
Master II

It would look something like this:

Integration:

LOAD * ;

SQL SELECT *

FROM view_rows?eid=38&max_rows=30000;

store Integration into c:\Data\Insurance\Transactions_qv.txt (txt);

IF ispartialreload() THEN

SET ErrorMode = 0;

DROP TABLE Validate;

SET ErrorMode = 1;

Validate:

ADD LOAD "Entity ID"as [Entity ID],

    Entity,

         if(Attribute = '','Context','Content') as [Business Rule Type],

    Attribute,

    "Rule Name" as [Rule Name],

    Description,

    Threshold,

    Result,

    "Passing Fraction" as [Pasing Fraction],

    "Failing Rows" as [Failing Rows],

    "Passing Rows" as [Passing Rows],

    "Passing Aggregate" as [Passing Aggregate],

    "Failing Aggregate" as [Failing Aggregate],

    date("Date Created",'DD/MM/YYYY') as [Date Created];

SQL SELECT "Entity ID",

    Entity,

    Attribute,

    "Rule Name",

    Description,

    Threshold,

    Result,

    "Passing Fraction",

    "Failing Rows",

    "Passing Rows",

    "Passing Aggregate",

    "Failing Aggregate",

    "Date Created",

FROM show_all_br?pid=39;

END IF

The enclosing IF statement is necessary to make sure that the Validate table is only read during a partial reload and not during a regular reload. To execute a Partial Reload, you can create a new button, add an External Action of Reload, and check the "Partial" checkbox. Again, keep in mind that this will only work in QV Desktop. To execute a partial reload when the application is open in QVS, you will need to use EDX triggers.

Alternatively, you may find it easier to create a separate "validation" application that will use this file and avoid the partial reload confusion altogether.

Regards,

Vlad

Not applicable
Author

Vlad, thats working exactly as envisioned. Thank you very much, greatly appreciated.

Regards

Robin