All Topics | Topic: “Branch.River does not seem to be working”
Author Message
Eng. Adel Abdallah
Subject: Branch.River does not seem to be working   
Posted: 3/5/2018 Viewed: 12981 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: 12969 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: 12956 times

Great! thanks Jack
Adel
Topic: “Branch.River does not seem to be working”