Solved

Export Set on Separate Tabs using AXLL


Badge +1

Hello - I'm creating a script to export a bunch of vars/params to Excel/CSV. It needs be pretty clean/standardized so it can be read into a UI.


I tried:

write AllVariables to file export_file;

But the output was too messy. 

 - Is there a way to silence Basic/NonBasic?

 - My output is often Nodes x Time, which AIMMS seems to prefer as (n,t), but then it shows Time as columns instead of rows (which is SUPER ugly in the text file). So I have to duplicate everything as parameters with (t,n) for the export. Or am I wrong?

 

So now I'm looking at using AXLL, but it's pretty tedious.

This is what I'm currently doing:

axll::CreateSheet("VarName1");

axll::WriteTable(Var1, "A2:A5", "B1:AZ1", "", 1, 1);



axll::CreateSheet("VarName2");

axll::WriteTable(Var2, "A2:A5", "B1:AZ1", "", 1, 1);

… ad nauseam

 

There has to be a better way. Is there something like:
for i in MySet do

   axll::CreateSheet(FormatString(“%e”, i));

   axll::WriteTable(i, “A2:A5”, “B1:AZ1”, "”, 1, 1);

endfor;

 

I want to print one variable per tab in Excel - I plan on formatting all vars/params so they'll play nicely with WriteTable, then put them in a Set.

Is this possible or is there a better way?

icon

Best answer by gabiservidone 26 May 2023, 15:40

View original

2 replies

Userlevel 5
Badge +6

Hey @Noob9000, hope that worked, but I also wanted to share another library that you can use to export Excel, it is called DEX https://documentation.aimms.com/dataexchange/index.html!

Userlevel 5
Badge +6

Hi,

I don’t see why your for idea wouldn’t work.

You can also use axll:WriteCompositeTable instead of axll::WriteTable if you don’t require specifics cells for the contents. 

 

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator