Importing table for report

In this subforum specific Topics concerning ZEN Core, e.g workbenches, are discussed
Post Reply
user-5572
Posts: 9
Joined: Thu Jan 01, 1970 1:00 am

Importing table for report

Post by user-5572 »

Hi,

is it possible to import a table form a CSV file into Zen as a new document?
(This line works just fine:

Code: Select all

table1 = Zen.Application.LoadTable("C:\\Users\\x\\Data.csv")
)
The following line should probably do what I want, but in my Zen version (Zen 2 Core) this command is not available:

Code: Select all

Zen.Application.Documents.Add(table1)
Is there any alternative for this line in the new Zen version?
I have tried this command, but it doesn't create a new table, but overwrites the document wich is currently selected as ActiveDocument:

Code: Select all

Zen.Application.ActiveDocument = table1
The imported table will be used afterwards in a Zen report.

Thank you in advance
user-4
Posts: 397
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

Hi Alexander,

ZEN Core has so far no document collection. Therefore Zen.Application.Documents.Add is not applicable.

I hope the following macro code is what you are looking for.

Code: Select all

myTable = Zen.Application.LoadTable("C:\\Users\\XGBWEISS\\myTable.csv") 

#Center Screen Area (Data presented by the workbench)
Zen.Application.ActiveDocument = myTable

#Right Tool Area (Defining the output of the workbench)
Zen.Application.ActiveWorkbench.SetOutputValue(myTable,'myTable')

Please keep in mind that running this code within the macro environment is just for testing and does not yield all results.
To see how it really works activate e.g. ‘Free Mode’, add your macro as a workbench and then press apply.
user-5572
Posts: 9
Joined: Thu Jan 01, 1970 1:00 am

Post by user-5572 »

Hi,

the macro code you provided imports and shows the table, as it should, but doesn't create a new table in Zen (which could be used in a Zen report).
The Table should be displayed also as a new object (document) in the left column of the Zen GUI.
Is this somehow possible?

Kind regards
user-4
Posts: 397
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

Hello Alexander,

I tested it again and it worked for me in 'Free Mode'.

As said before:

To see how it really works activate e.g. ‘Free Mode’, add your macro as a workbench and then press APPLY. (NOT RUN ;-)
user-5572
Posts: 9
Joined: Thu Jan 01, 1970 1:00 am

It worked

Post by user-5572 »

Thank you for your help,
finally it works now
user-5572
Posts: 9
Joined: Thu Jan 01, 1970 1:00 am

not working anymore in the new Zen version

Post by user-5572 »

in Zen Core version 2.0.66.1000 the code you provided works just fine, but unfortunately on my second computer with Zen version 2.4.72.0 the same code does not add a new table. Even if I execute the macro by clicking on apply.
Does anyone know what could be different in the new Version?

thank you in advance and best regards,
Alexander
user-9
Posts: 82
Joined: Thu Jan 01, 1970 1:00 am

Post by user-9 »

Sorry, this is a bug and we will provide a hotfix soon.
user-4
Posts: 397
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

Dear Alexander,

the hotfix to correct the problem you reported is planned to be released by the end of October, 2017.

Thank you for your contribution!
Post Reply