Welcome to WEAP's Website
WEAP
WEAP is an initiative of the Stockholm Environment Institute.


About WEAP

Home
Why WEAP?
Features
What's New?
Sample Screens
Demonstration
Applications
Publications
History and Credits

Using WEAP
Download
Licensing
User Guide
Tutorial
Videos
Resources

User Forum
Discussions
Members List
Edit Profile

Additional Support
Training
University Courses
Collaboration

About Us
SEI-US Water Resources Program
Please Contact Us


Environmental News
LEAP
Interested in Energy?
Read about LEAP: SEI's software for energy planning.

User Forum

All Topics | Topic "How to easily export many results using a script"
Log in to post new messages or reply to existing messages.
 
Author Message
Jack Sieber

Subject: How to easily export many results using a script   
Posted: 5/7/2015 Viewed: 7447 times
Here's how to automate the export of many different result for many scenarios. First, you need to save as Favorites the tables you want to export, making sure that scenario is NOT the legend or X axis dimension. Once the favorites exist, you can run a script, using the WEAP API, to export the favorites for all scenarios to CSV files. Look in the help under Advanced Topics, Automating WEAP for information about the API and scripting.

I would look something like this:

File: ExportResults.vbs

Set WEAP=CreateObject(“WEAP.WEAPApplication”)

' Make sure WEAP is fully started
While Not WEAP.ProgramStarted
Sleep (1)
Wend

For Each S in WEAP.Scenarios
  If Not S.IsCurrentAccounts Then
    CALL WEAP.LoadFavorite("Groundwater Storage")
    WEAP.ResultView("Scenario") = S.Name
    CALL WEAP.ExportResults("GW_" + S.Name + ".CSV", TRUE, TRUE)

    CALL WEAP.LoadFavorite("Unmet Demand")
    WEAP.ResultView("Scenario") = S.Name
    CALL WEAP.ExportResults("Unmet Demand_" + S.Name + ".CSV", TRUE, TRUE)
  End If
Next


soroosh alahdin

Subject: Re: How to easily export many results using a script   
Posted: 7/17/2015 Viewed: 7096 times
hi very dear jack
i noticed when the demand site are more than 12, in Results, the rest i mean the 13th, 14 th, ... are shown as ALL OTHERS, and in automation, i cannot go to the window and choose them manually, is there any way to show them directly so the exportation will be complete?
soroosh alahdin

Subject: Re: How to easily export many results using a script   
Posted: 7/17/2015 Viewed: 7085 times
hi again
I have to mention that "exportresults" give only the active results table, so when exporting, I miss the 13th and 14th.
and also because I am in a script I cannot make them active manually.
thanks
soroosh alahdin

Subject: Re: How to easily export many results using a script   
Posted: 7/17/2015 Viewed: 7081 times
hi
can the scenario explorer table be also exported in scripting mode?
Jack Sieber

Subject: Re: How to easily export many results using a script   
Posted: 7/17/2015 Viewed: 7075 times
Click the "Grp" button on the chart toolbar (to the right of the chart) to toggle between grouping

If there are more than 12 items in the results legend, you can click the Grp button to group the smallest items together into "All Others." You can change this setting in a script:

WEAP.ResultView("Group") = True

It is not possible to export the Scenario Explorer table in a script (via the WEAP API).

Jack

soroosh alahdin

Subject: Re: How to easily export many results using a script   
Posted: 7/20/2015 Viewed: 7033 times
another question
is rhere anyway that i can export two tables (in addition to active table)with exportresult command?
Jack Sieber

Subject: Re: How to easily export many results using a script   
Posted: 7/22/2015 Viewed: 7027 times
If you call ExportResult when WEAP is in the Scenario Explorer view, it will export all of the tables in the overview to one CSV file.
Topic "How to easily export many results using a script"