Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

geogou1973
New Contributor II

Export in excel with script module.

Hello.

I have an issue with an export i'm trying to do and does not work.

I have a script module in a trigger on post reload action that exports an excel file from a chart.

The script is :

Sub ExportFiles

Pathcorp="c:\sales\"

Set corp = ActiveDocument.GetSheetObject("CH01")

If store_id="101" then

corp.ExportBiff Pathcorp & "Sales.xls"

End if

End Sub

The store_id is field.


How can i export only the data for the store "101"

Can anyone help me ?


Thank you in advance

1 Solution

Accepted Solutions
omyahamburg
Contributor II

Re: Export in excel with script module.

Maybe this works:

replace your if with

ActiveDocument.Fields("store_id").Select "101"


Joerg

3 Replies
omyahamburg
Contributor II

Re: Export in excel with script module.

Maybe this works:

replace your if with

ActiveDocument.Fields("store_id").Select "101"


Joerg

geogou1973
New Contributor II

Re: Export in excel with script module.

It works.

Thank you very much

Not applicable

Re: Export in excel with script module.

Hi,

Try this

Create Variables from UI

1. vPathcorp ---> Your desired path to save the exported excel file

2. vstore_id ---> Your store selection (should always one at a time)

Sub ExportFiles

Set Pathcorp = ActiveDocument.Variables("vPathcorp")
Set store_id = ActiveDocument.Variables("vstore_id")

'Pathcorp="c:\sales\"

Set corp = ActiveDocument.GetSheetObject("CH01")

If store_id.GetContent.String="101" then

corp.ExportBiff Pathcorp.GetContent.String & "Sales.xls"

End if

End Sub

Community Browser