Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Data Reduction after On Post Reload.

Hi,

My requirement is to reduce the data after on post reload.

Reduction data is passed from Excel sheet.

In example you can find the Reduction data in DataToReduce sheets.

There is no restriction for no.of reduction field.

for example :for 1st reload there will be 3 reduction and for next time it may be more or less than 3 fields(Item,Store,Status).

After reload these fields has to identify and remove the fields values already loaded in qlikview memory.

You can see below attached files for reference how to reduce data on post reload.

For Example:On DataToReduction sheet if i add field Item,Store And Status then after reload these fields with that field values had to be reduce in the data model.

But i want the code to be more generic ,so that we can apply for any field and for any field value.

Thanks In Advance

Anil

10 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

DataToReduceItem:

MAPPING LOAD DISTINCT Item,

'Reduce' AS ItemValue

FROM

Item.xlsx

(ooxml, embedded labels, table is DataToReduce);

DataToReduceStatus:

MAPPING LOAD DISTINCT Status,

'Reduce' AS StatusValue

FROM

Item.xlsx

(ooxml, embedded labels, table is DataToReduce);

DataToReduceStore:

MAPPING LOAD DISTINCT Store,

'Reduce' AS StoreValue

FROM

Item.xlsx

(ooxml, embedded labels, table is DataToReduce);

Data:

NoConcatenate

LOAD

Item,

Status,

Store

WHERE ItemReduce <> 'Reduce' AND StatusReduce <> 'Reduce' AND StoreReduce <> 'Reduce';

LOAD Item,

     Status,

     Store,

     ApplyMap('DataToReduceItem', Item) AS ItemReduce,

     ApplyMap('DataToReduceStatus', Status) AS StatusReduce,

     ApplyMap('DataToReduceStore', Store) AS StoreReduce

FROM

Item.xlsx

(ooxml, embedded labels, table is Data);

Hope this helps you.

Regards,

jagan.

Not applicable
Author

I don't want to use where filters in the script but i am trying to reduce the data after reload.While reload i want full load and after completion of reload ,data reduction has to happen by selecting the loaded reduce data from excel

which has to happen automatically with out selecting the reduce data manually.(By Macro).

jagan
Luminary Alumni
Luminary Alumni

Hi,

Using macros will have lot of issues, it won't work in Ajax Mode, the script which I have given is a dynamic one.  It works for all the scenrios.

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

But my requirement is to find reduction data automatically and remove from qvw file.

Is this possible with out macros?

Not applicable
Author

As Jagan Said, macro wont works perfectly with AJAX client.

But you have couple options to reduce the data. 1. Publisher reduction  2. Add the data deletion logic to script.

1. First add the Flag to your data model on which fields need to be reduce with excel Input. So the script simply add the Flag to reduction fields. So you can use "Reduce data" option publisher & create new qvw on User documents.

2. In the script add the Flag to execute the specific reduction script like below

Full reload script

SET IsDataReduction = Y ;

IF '$(IsDataReduction) = 'Y' THEN

     Logic to reduce the data with inner join from excel file reduction fields.

ENDID

jagan
Luminary Alumni
Luminary Alumni

The script helps you in implementing without using Macros.  I am not sure why you are not trying the given script.  The script automatically reduces the given values.

If there is any issue in the script let me know, will try another method.

Regards,

Jagan.

Not applicable
Author

Restriction is we should not change any thing in the script but reduction should be happen after reload.

like Using OnPostReload trigger.And we trigger macros after reload.

Not applicable
Author

You are not changing any thing to your main script. You simply adding the new script code to apply the reduction at end of your script.

Not applicable
Author

You can also write code optionally execute the reduction script.