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
Publications
History and Credits

Using WEAP
Download
Licensing
User Guide
Tutorial
Videos (YouTube)

User Forum
Discussions
Members List
Edit Profile

Additional Support
Training
University Courses
Collaboration

About Us
SEI-US Water Resources Program
Please Contact Us

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

Link WEAP and LEAP for combined Water-Energy planning.
Watch a video demo!
   

User Forum

All Topics | Topic "Branch.River does not seem to be working"
Log in to post new messages or reply to existing messages.
 
Author Message
Eng. Adel Abdallah

Subject: Branch.River does not seem to be working   
Posted: 3/5/2018 Viewed: 9858 times
Hi,

I'm trying to access the River name where the reservoirs or reaches are located on.

I tried this simple script but it gives me the error below

FOR EACH Br IN WEAP.Branches
  if BR.TypeName="Reservoir" THEN
    print BR.River
  END IF
NEXT

Error: Could not convert variant of type (Dispatch) into (OleStr)

Could you please help me to get the call Branch.River to work?

Thanks

Mr. Jack Sieber

Subject: Re: Branch.River does not seem to be working   
Posted: 4/16/2018 Viewed: 9848 times
River is not a valid property of the Branch API object.

Here is a simple script that will list the river name for each reservoir:

FOR EACH River in WEAP.Branch("Supply and Resources\River").Children
  FOR EACH RiverType in River.Children
    IF RiverType.Name = "Reservoirs" THEN
      FOR EACH Child in RiverType.Children
        Print Child.Name & " is on River " & River.Name
      NEXT
    END IF
  NEXT
NEXT
Eng. Adel Abdallah

Subject: Re: Branch.River does not seem to be working   
Posted: 4/16/2018 Viewed: 9837 times
Great! thanks Jack
Adel
Topic "Branch.River does not seem to be working"