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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
ND1
Contributor
Contributor

Export multiple objects based on length

Hello,

I managed to export multiple objects in excel  using the code found in

https://community.qlik.com/t5/QlikView-Scripting/Exporting-multiple-objects-to-multiple-Excel-sheets...

or in

https://community.qlik.com/t5/QlikView-Documents/Export-Qlikview-objects-to-multiple-Excel-sheet/ta-...

Although, now I encounter another problem.....

I want to export the same objects in data type and the problem is that the length of each object varies and changes depending on the selections.

So I'm wondering if there a way to define the object's position in the exported excel depending on the length of the previous/above table??
i.e. instead of writing e.g. "A1", "A10", "A20", .., " A60"

That is, if the first (1st) exported object has 20 rows, I want it to be placed in "A1" and the next (2nd) in "A22". (leave a row between tables)
Then if the 2nd has 12 rows, I want the third (3rd) to be placed in "A35" (35 = 22+12+1), etc.

I have seen somewhere the "A"&iCount, where iCount can be a variable containing the lengths?
I don't know how it can work.
Can I use something like this to the code I've already found and tested? which is the one described in the attached links.

Thank you!!!

1 Reply
marcus_sommer

You could count the number of dimension-values within your objects, like:

count(distinct Dim1&Dim2&Dim3)

within a Qlik variable which you queries within the macro. And there you have a macro-variable which iterates this value within your loop + the header of your table + total lines + your distance rows.

Another way would be to check the last row within Excel with UsedRange or similar features. For this take a look on the various vba communities and you will find a lot of examples.

I think the second suggestion would be easier to implement.

- Marcus