Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

stock positif , stock negatif and stock null in excel file

I have the following report

Sans titre.png

I export the report aitomatically using the following script

FOR i=0 to Field.Count-1

  Doc.Fields("CodeGroupe").Clear

  Doc.FIelds(FieldName).SELECT Field.Item(i).Text

  Set xlApp = CreateObject("Excel.Application")

  xlApp.Visible = FALSE

  SET xlBook = xlApp.Workbooks.Add

  SET xlSheet = xlBook.Worksheets("Feuil1")

  XLSFile = "G:\test_"&A.GetContent.STRING&"_"&Field.Item(i).Text&".xls"

  Doc.GetApplication.WaitForIdle

  Doc.GetSheetObject("CH1002731").CopyTableToClipBoard TRUE

  xlApp.ActiveSheet.Paste

  xlApp.Worksheets(xlApp.ActiveSheet.Index).Cells.EntireColumn.AutoFit

  xlApp.Worksheets(xlApp.ActiveSheet.Index).Cells.EntireRow.AutoFit

  strSheetName = Field.Item(i).Text

  xlApp.ActiveSheet.Name = strSheetName

  xlApp.ActiveWorkbook.Worksheets.Add

  xlApp.DisplayAlerts = FALSE

  Call Excel_DeleteBlankSheets(xlBook)

  xlBook.SaveAs XLSFile, 56

  xlBook.Close

  XLSFile = ""

          next

How could I export stock positif , stock negatif and stock null each one in a separate sheeet ?

1 Solution

Accepted Solutions
marcus_sommer

Very probably I would use a particular object for each (maybe in a hidden sheet) and export them. For this you would need a condition in your objects, maybe something like this:

if(aggr(YourExpression, [Libelle Article]) < 0, [Libelle Article]) // respectively = 0 or > 0

Of course you could also filter and copy or filter and delete the data within excel but I doubt that it would be easier.

- Marcus

View solution in original post

1 Reply
marcus_sommer

Very probably I would use a particular object for each (maybe in a hidden sheet) and export them. For this you would need a condition in your objects, maybe something like this:

if(aggr(YourExpression, [Libelle Article]) < 0, [Libelle Article]) // respectively = 0 or > 0

Of course you could also filter and copy or filter and delete the data within excel but I doubt that it would be easier.

- Marcus