All Topics |
Topic: “How to easily export many results using a script”
Author | Message |
---|
Subject: How to easily export many results using a script
Posted: 5/7/2015 Viewed: 27247 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 |
Subject: Re: How to easily export many results using a script
Posted: 7/17/2015 Viewed: 26881 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? |
Subject: Re: How to easily export many results using a script
Posted: 7/17/2015 Viewed: 26855 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 |
Subject: Re: How to easily export many results using a script
Posted: 7/17/2015 Viewed: 26836 times
hi
can the scenario explorer table be also exported in scripting mode? |
Subject: Re: How to easily export many results using a script
Posted: 7/17/2015 Viewed: 26819 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 |
Subject: Re: How to easily export many results using a script
Posted: 7/20/2015 Viewed: 26775 times
another question
is rhere anyway that i can export two tables (in addition to active table)with exportresult command? |
Subject: Re: How to easily export many results using a script
Posted: 7/22/2015 Viewed: 26761 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.
|
Subject: Re: How to easily export many results using a script
Posted: 5/11/2018 Viewed: 17219 times
I have a question with regards to the setting of the group option. I'm using pywin32 for controlling WEAP:
import win32com.client weap = win32com.client.Dispatch("WEAP.WEAPApplication") however, once I loaded the area, if I try to set the group option by: weap.ResultView("Group") = False I get SyntaxError: can't assign to function call also, if I try to to weap.ResultView("Group") WEAP throws an error: WEAPApplication.ResultView: This feature is not implemented. What's going wrong here? I'm using the most recent version of WEAP. Is it perhaps not the correct function, since a scenario called "Group" would then lead to an error? |
Subject: Re: How to easily export many results using a script
Posted: 5/13/2018 Viewed: 17192 times
Dear michael
It would be better to do the setting with group button in the weap. What ever your client program is(matlab or python)it is easier to change the setting in the righthand side toolbar and grp button. |
Subject: Re: How to easily export many results using a script
Posted: 5/13/2018 Viewed: 17188 times
I do not know why it is not working in Python. I just tried it again in Visual Basic Scripting (VBS) and it worked fine. Do you have problems setting other ResultView properties?
Jack |
Subject: Re: How to easily export many results using a script
Posted: 10/31/2024 Viewed: 5229 times
I have discovered an alternative syntax that works for calling ResultSetting from Python:
WEAP.SetResultSetting("Group", 0) (Use 0 for False and 1 for True) Jack |
Topic: “How to easily export many results using a script”